Rust Community == Awesome!

23 April 2016

When I started learning Rust I was a bit worried that the library situation could be a problem, because the standard library is so lean you could call it luaesque, and where other languages had multiple competing libraries to do stuff, there was at best one library that did it right, but more often than not zero or more unfinished libraries.

Still, I distinctly remember being in awe at the considerate language design, so I continued my forays. I soon learned that while the community was fairly small and working on many fronts to expand the fledgling ecosystem, they were also very adroit, friendly and helpful. I’ve tried to emulate this stance (and I hope it has worked out all right so far) in my interactions with the community.

The Rust Community is an awesome bunch.

I was recently reminded of this when writing a ( still secret no longer secret) project, and wanted to use a small database to persist data between two processes. I initially thought sqlite was perfect for the job, so I was about to add rusqlite to my dependencies when I noticed the following tweet:

Diesel’s query builder is now faster than a SQL string literal. — Sean Griffin on twitter

A nice type-safe API and performance improvements? Where can I sign up? But before I did so, I wanted to make sure Diesel could fit my use case. The thing I wanted was a relation between two entities (that could be stored as simple String s) where rows should be unique. So sqlite’s INSERT OR REPLACE statements would be the obvious solution (Another would be to set a handler that would silently drop statements that would fail the constraint, but I’d probably struggle to make that work).

Anyway, I opened an issue at the Diesel github that was promptly closed because it was a duplicate of another (that had quite different wording, so I missed it in my search) – along with a message by Sean Griffin that it was going to be fixed within the next days (and in fact only a few hours later there is a work-in-progress PR that appears to do exactly what I wanted. Excellent!)

Another thing happened when I revisited the Rust benchmarksgame entries and found that regex now has a regex::bytes submodule that is capable to match and replace stuff on byte slices. So I tried to incorporate this into the regex_dna benchmark, but found out that it performed worse than the &str version, despite getting rid of the Unicode check.

So I pinged Andrew Gallant, the original author of the regex crate, and he found and fixed the problem in the matter of hours. So with the next release, the benchmark will likely get a bit faster still (I’m waiting on a crates.io release to keep the Makefile simple). Cool!

So this is how the Rust community wins despite its small size and incomplete ecosystem: By being ridiculously active, friendly, helpful and forthcoming. This post is basically a big THANK YOU to the awesome Rust developers out there. You know who you are.