DEV Community


Rust Must-Know Crates

Christopher Durham
Rust fan and Programming Language Enthusiast
・6 min read

This is my collection of Rust crates that I often find myself using. Not every project needs to use all of them, but most projects are better off knowing that they exist. Crates are very loosely ordered within their heading from more generally useful to more niche application.

This list will be kept somewhat up to date as my preferences and the ecosystem shift. This is obviously not a complete list of great crates, but just an introduction to the great ecosystem of Rust utilities available to programmers.

Cargo Plugins


This tool extends Cargo to allow you to add, remove, and upgrade dependencies by modifying your Cargo.toml file from the command line.

Currently available subcommands:

  • cargo add
  • cargo rm
  • cargo upgrade


A cargo subcommand for displaying when Rust dependencies are out of date.


A Cargo subcommand that visualizes a crate's dependency graph in a tree-like format.


A Cargo subcommand for checking and applying updates to installed executables.


Print out the result of macro expansion and #[derive] expansion applied to the current crate.


A cargo plugin for showing an overview of a crate's modules.


Tarpaulin is designed to be a code coverage reporting tool for the Cargo build system, named for a waterproof cloth used to cover cargo on a ship. Currently, tarpaulin provides working line coverage but is still in the early development stage and therefore may contain some bugs.


Audit Cargo.lock for crates with security vulnerabilities reported to the RustSec Advisory Database.


A tool helping Rust users review crates they use, and share it with the community. It works as a recomendation system, helps identify poor quality, protects against many attack vectors, and aims at driving the quality of Rust ecosystem even higher, by encouraging continous peer review culture.


Fetch the source code of a Rust crate.

cargo clone will likely be added to cargo proper at some point.



Rust has lots of builtin traits that are implemented for its basic types, such as Add, Not or From. However, when wrapping these types inside your own structs or enums you lose the implementations of these traits and are required to recreate them. This is especially annoying when your own structures are very simple, such as when using the commonly advised newtype pattern (e.g. MyInt(i32)).

This library tries to remove these annoyances and the corresponding boilerplate code. It does this by allowing you to derive lots of commonly used traits for both structs and enums.

Derives for:


Custom derive for automatically implementing the Default trait with customized default values.


Rust macro to automatically implement the builder pattern for arbitrary structs. A simple #[derive(Builder)] will generate a FooBuilder for your struct Foo with all setter-methods and a build method.


A set of macros and traits for working with enums and strings easier in Rust.

Derives for:

Meta-programming (macros)


Syn is a parsing library for parsing a stream of Rust tokens into a syntax tree of Rust source code.


A runtime-compatible wrapper around the procedural macro API of the compiler's proc_macro crate.


The quote! macro as a procedural macro, instead of the original quote! macro, implemented with macro_rules!.

The quote! macro turns Rust syntax tree data structures into tokens of source code.


A flexible way to paste together identifiers in a macro, including using pasted identifiers to define new items.



Snapshots tests (also sometimes called approval tests) are tests that assert values against a reference value (the snapshot). This is similar to how assert_eq! lets you compare a value against a reference value but unlike simple string assertions snapshot tests let you test against complex values and come with comprehensive tools to review changes.


Trybuild is a test harness for invoking rustc on a set of test cases and asserting that any resulting error messages are the ones intended.


Helps you write fast code by detecting and measuring performance improvements or regressions, even small ones, quickly and accurately. You can optimize with confidence, knowing how each change affects the performance of your code.

Other Libraries


A Rust library for parsing, compiling, and executing regular expressions. Its syntax is similar to Perl-style regular expressions, but lacks a few features like look around and backreferences. In exchange, all searches execute in linear time with respect to the size of the regular expression and search text.


A macro for declaring lazily evaluated statics in Rust.

Using this macro, it is possible to have statics that require code to be executed at runtime in order to be initialized. This includes anything requiring heap allocations, like vectors or hash maps, as well as anything that requires non-const function calls to be computed.


Rayon is a data-parallelism library for Rust. It is extremely lightweight and makes it easy to convert a sequential computation into a parallel one. It also guarantees data-race freedom.


Serde is a framework for serializing and deserializing Rust data structures efficiently and generically.

The Serde ecosystem consists of data structures that know how to serialize and deserialize themselves along with data formats that know how to serialize and deserialize other things. Serde provides the layer by which these two groups interact with each other, allowing any supported data structure to be serialized and deserialized using any supported data format.


Serde serializable and deserializable trait objects.

This crate provides a macro for painless serialization of &dyn Trait trait objects and serialization + deserialization of Box<dyn Trait> trait objects.


A set of tools for concurrent programming.


Extra iterator adapters, functions and macros.


A Rust library for random number generation.

Rand provides utilities to generate random numbers, to convert them to useful types and distributions, and some randomness-related algorithms.


A Rust library providing a lightweight logging facade.


A cross platform Rust library for efficiently walking a directory recursively. Comes with support for following symbolic links, controlling the number of open file descriptors and efficient mechanisms for pruning the entries in the directory tree.


A tiny mid-level library that provides platform-specific standard locations of directories for config, cache and other data on Linux, Windows and macOS by leveraging the mechanisms defined by the XDG base/user directory specifications on Linux, the Known Folder API on Windows, and the Standard Directory guidelines on macOS.


A secure, cross-platform, temporary file library for Rust. In addition to creating temporary files, this library also allows users to securely open multiple independent references to the same temporary file (useful for consumer/producer patterns and surprisingly difficult to implement securely).


A collection of numeric types and traits for Rust, including bigint, complex, rational, range iterators, generic integers, and more!


Parse command line argument by defining a struct. It combines clap with custom derive.


Rust crate for a convenient RAII scope guard that will run a given closure when it goes out of scope, even if the code between panics (assuming unwinding panic).


Safely cast &T to &U where the struct U contains a single field of type T.


Macros for conditional compilation according to rustc compiler version, analogous to #[cfg(...)] and #[cfg_attr(...)].

Discussion (2)

chenjianxin profile image

thank you
I love it

flrnd profile image
Florian Rand

Thank you for sharing this! Rust is in my 'I want to learn' list and this is going to be handy in the near future!