Nevertheless, she persisted

Rust's Small Standard Library

Most of this content is unoriginal, though I’m unable to find it all in one place like this.

Rust’s standard library is pretty small. The rationale is that a small std can focus on only the most common, basic functionality. crates.io and cargo make dependencies easy (unlike c/c++). 3rd party crates can make breaking changes and iterate faster. Thus de-facto standards have emerged amongst the community (with many rust-lang members working on these crates).

I will not highlight which crates these are, because the list is dynamic and me talking about the most popular crates feeds that popularity. crates.io and lib.rs both sort crates by categories, keywords, and downloads. Go there for a list.

I’m really impressed / surprised with rust’s design choice. Rust’s stdlib does not have serialization, http, random, async/await, crypto, logging, gui, datetime, etc. I don’t know if any languages with all of these things, but it is unusual that these are all missing.

For comparison, in the Java world, maven and gradle make dependencies easy as well. But the java stdlib is massive and obsessively focused on backwards compatibility, which has resulted in growing pains. And while gradle makes using dependencies easy, publishing them to maven central is relatively complicated. Its common to fiddle with transitive dependencies due to name or version clashes.

Slightly related, Rust lacks named parameters, default parameters, or overloading. I don’t like this (Kotlin and Ocaml have all three, and spoilt me with them). Unfortunately, this means many functions are trivial variants of each other (for example, using with to donate that this function takes additional parameters or else when taking a closure for lazy evaluation). See Result or Option for many examples. While the explicitness is nice, remembering the names of function variants is not. I hope someone can explain if I’m wrong. Of course the above does not exist in a vacuum. rustdoc, docs.rs make documenting much easier, so looking up what you need is never a hassle. I just wish I didn’t have to do that as often.

Conclusion

I like the rust ecosystem a lot, and I love that I get all the goodies I expect in std elsewhere easily. I just wish I could use my autocomplete without wondering what’s the difference between open and open_with.

#Rust #Dev