I thought I’d write up my first experience trying to use Rust in ernest.
For my first project, I thought I’d make a simple application that expands patterns like “i18n” into the list of matching English words i.e. “institutionalization", “intercrystallization”, “interdifferentiation” and “internationalization”. The code is here: https://github.com/brianquinlan/learn-rust/blob/master/i18n/sets/src/main.rs
At first glance, the project seemed very straightforward and I would be 90% there by cargo-culting various examples from the book.
The first snag I hit was the difference between str and String. Almost all of the examples use literal strings which makes lifetime management easier than you’d find in most non-trivial programs. It would be nice if the str/String difference were dealt with completely in an easy-to-find place since it might be surprising to people coming from other languages.
I also found the list of Trait implementations at the end of each struct’s documentation a bit hard to follow. The method descriptions are on a linked page which makes in-page search difficult and confuses Google. For example, googling for "string equality rust” has this as the first relevant result: https://doc.rust-lang.org/std/str/ . But that page doesn’t contain the words “equal” at all. Maybe include the one sentence method description next to the method signature?
Some patterns feel very verbose when coming from other languages e.g.
- var.unwrap() everywhere
Some of the unstable APIs are really nice and I was disappointed that I couldn’t use them in the beta version
Overall, it was a fun experience and I plan on continuing to learn rust.