The Expressive C++17 Coding Challenge (in Rust)

A few weeks ago, two C++ bloggers initiated a challenge: use the shiny new features of C++17 to write a small program that manipulates CSV files. The link is to the results; you can see the examples people came up with.

I decided to implement it in Rust for fun. You should give it a try, in whatever language you use, it’s a nice sample problem. I held myself to the same constraints as the original contest; no external packages is a bit painful in Rust, but it’s not too bad. Mostly it would let me eliminate boilerplate while also improving correctness, and making the code a bit shorter.

Anyway, here it is:

https://gist.github.com/steveklabnik/ad0a33acc82e21ca3f763e4278ad31a5

I implemented From for everything so I could use ?, but then main just has a ton of unwraps. I normally would remove those too, but the challenge does not include good error handling, so I decided to just stick to the text of the challenge.

I’m not going to say that this is the best Rust code in the world, nor compare it directly to the C++ examples. But it was a fun hour or two to knock it out, and figured I’d at least share my results.

 
866
Kudos
 
866
Kudos

Now read this

Git, history modification, and libuv

There has been a recent kerfuffle over a pull request to libuv: it was rejected, applied, reverted, and re-applied. There was some question as to the authorship of that commit, and I wanted to show you why that was, because it... Continue →