I started, what I thought would be a relatively short, page on our internal wiki about things I appreciated having worked with Rust for a while. It started with a co-worker’s excellent presentation to teams on our experience building a prototype in rust, which I felt I should contribute to as he credited me with some of the work. I coined the term “Rustiom” as a contraction of “Rust Idiom”, or something that sounded more technical than “Rustism”. The goal is to deal with idioms in the way that Rustaceans write code as well as just cool things in the language and libraries.

This was the introduction to the work version.

This is really a collection of thoughts on Rust programming especially those parts I have found to be either really great, or maybe not. This won’t be a good, bad, ugly kind of post because a lot of this kind of thing is very subjective, I’ll point out the things I like and those which I appreciate (not sure I enjoy them, but they are valuable). There are some things I don’t necessarily appreciate, but I’ll leave that for another day.

Rather than the over sized single page my plan here is to break it into a series of posts and try and tackle related topics rather than as the original sort of stream of “oh yeah, and then there’s this!”. To kick off the series, below are the documentation and article links I find useful and my curated set of go-to crates.

  1. Rust Language Cheat Sheet
  2. The Rust Programming Language (Book)
  3. The Edition Guide
  4. The Unstable Book
  5. Standard Library Documentation
  6. 3rd Party Libraries for Rust
  7. Rust Playground

These are other pages and articles I have either read more than once or forwarded to others for some reason.

  1. Rust Design Patterns (unofficial)
  2. Rust Cookbook
  3. Idiomatic Rust; Guidelines for writing elegant Rust programs
  4. Elegant Library APIs in Rust (from [Pascal’s Scribbles)

My List of Useful Crates

These seem to be the most commonly used across the projects I’ve worked on so far.

  • criterion; Statistics-driven micro-benchmarking library
  • lazy_static; A macro for declaring lazily evaluated statics in Rust.
  • log; A lightweight logging facade for Rust; this is the log sending portion, you’ll need another crate to actually capture, format and output the log.
    • env_logger is a simple and common log capture crate, good for services or interactive tools. I prefer flexi_logger these days over env_logger.
    • pretty_logger is a nice approach using logging interactively, not so much for services. fern is a nice configurable capture crate although I’ve not tried it.
    • tracing (facade) and tracing-subscriber (capture) are a very high-performance approach that also supports spans, timing and more, but very service oriented.
  • num; A collection of numeric types and traits for Rust, including bigint, complex, rational, range iterators, generic integers, and more!
  • pest; (with pest_derive, and maybe pest_consume) a parser library using PEGs.
  • proptest; Proptest is a property testing framework (i.e., the QuickCheck family) inspired by the Hypothesis framework for Python.
  • regex; An implementation of regular expressions for Rust. This implementation uses finite automata and guarantees linear time matching on all inputs.
  • serde; Serde is a framework for serializing and deserializing Rust data structures efficiently and generically.
  • structopt; Parse command line argument by defining a struct. More ergonomic than clap.
  • tokio; An event-driven, non-blocking I/O platform for writing asynchronous I/O backed applications.
  • toml; A native Rust encoder and decoder of TOML-formatted files and streams.

Contents, Complete & Upcoming