Must know rust crates

This repository contains a list of the most common must know crates in the rust ecosystem. It intends to be a short and evolving overview of useful development crates and tools for Rust. For a more exhaustive list, including software written in Rust and all kinds of frameworks, you are probably better served by checking out the Awesome Rust list. The crates are group into no_std, std, build, test, macro, cargo and further which platform and project they are useful for.

Table of contents

no_std

General

Most of the listed crates such as the serde, serde_derive, tap, ... may also be useful in std environment.

  • heapless: Static friendly data structures that don't require dynamic memory allocation. [#static, #no-heap] crates.io
  • tap: Provides extension methods on all types that allow transparent, temporary, inspection/mutation (tapping), transformation (piping), or type conversion. [#tap_some #tap, #functional, #tap_ok, #pipe] crates.io
  • serde: Serde is a framework for serializing and deserializing Rust data structures efficiently and generically. [#serialization, #no_std, #serde] crates.io
  • serde_derive: Serde is a framework for serializing and deserializing Rust data structures efficiently and generically. [#serialization, #no_std, #serde] crates.io
  • snafu: SNAFU is a library to easily assign underlying errors into domain-specific errors while adding context. [#no_std, #ergonomic, #library, #error] crates.io
  • once_cell: once_cell provides two new cell-like types, unsync::OnceCell and sync::OnceCell. [#static, #lazy] crates.io
  • rand: A Rust library for random number generation. [#rng, #random] crates.io
  • itertools: Extra iterator adaptors, functions and macros. [#zip, #product, #group-by, #iterator, #data-structure] crates.io
  • Crossbeam: Provides a set of tools for concurrent programming. [#garbage, #non-blocking, #rcu #atomic, #lock-free] crates.io
  • nom: nom is a parser combinators library written in Rust. [#parser, #parsing, #streaming, #bit, #parser-combinators] crates.io
  • num: A collection of numeric types and traits for Rust. [#mathematics, #numerics, #bignum] crates.io
  • nalgebra: Linear algebra library for the Rust programming language. [#math, #algebra, #linear, #matrix, #vector] crates.io
  • Chrono: It aims to be a feature-complete superset of the time library. [#time, #date, #calendar] crates.io
  • lazy_static: A macro for declaring lazily evaluated statics in Rust. [#macro, #static, #lazy] crates.io
  • time: Date and time library. Fully interoperable with the standard library. [#time, #date, #calendar, #duration] crates.io

Platform

Embedded

  • Awesome Rust Embedded This is a curated list of resources related to embedded and low-level programming in the programming language Rust, including a list of useful crates.
  • embedded-hal: A Hardware Abstraction Layer (HAL) for embedded systems. [#io, #hal] crates.io
  • svd2rust: Generate Rust register maps (structs) from SVD files. [#map, #embedded, #generator, #register, #svd] crates.io
  • defmt: defmt ("de format", short for "deferred formatting") is a highly efficient logging framework that targets resource-constrained devices, like microcontrollers. [#logging, #logger, #formatter, #formatting, #knurling] crates.io
  • cargo-flash: This crate provides a cargo subcommand to flash ELF binaries onto ARM chips. [#embedded] crates.io
  • cargo-embed: This crate provides a cargo subcommand to work with embedded targets. [#embedded] crates.io
  • embedded-hal-mock: This is a collection of types that implement the embedded-hal traits. [#io, #i2c, #hal, #delay, #spi] crates.io
  • ufmt: A (6-40x) smaller, (2-9x) faster and panic-free alternative to core::fmt. [#display, #write, #format, #debug] crates.io
  • smoltcp: A TCP/IP stack designed for bare-metal, real-time systems without a heap. [#udp, #ethernet, #ip, #tcp, #network] crates.io
  • acid_alloc: This crate provides allocators that are suitable for use on bare metal or with OS allocation facilities like mmap(2)/brk(2) [#no_std, #allocator] crates.io

Wasm

  • Rust Wasm Book This small book describes how to use Rust and WebAssembly together.
  • wasm-pack: This tool seeks to be a one-stop shop for building and working with rust- generated WebAssembly that you would like to interop with JavaScript, in the browser or with Node.js. crates.io
  • wasm-bindgen-futures: This crate bridges the gap between a Rust Future and a JavaScript Promise. crates.io
  • js-sys: Raw bindings to JS global APIs for projects using wasm-bindgen. crates.io
  • web-sys: Raw bindings to Web APIs for projects using wasm-bindgen. crates.io

std

General

Also check out the no_std general section as most of the crates in no_std general will also be useful in the std environment.

  • Rayon: Rayon is a data-parallelism library for Rust. [#performance, #thread, #parallel, #join, #concurrency] crates.io
  • camino: This repository contains the source code for camino, an extension of the std::path module that adds new Utf8PathBuf and Utf8Path types. [#unicode, #filesystem, #utf8, #paths] crates.io
  • strum: Strum is a set of macros and traits for working with enums and strings easier in Rust. [#macros, #string, #enum, #proc-macros] crates.io

Libraries

  • thiserror: Provides a convenient derive macro for the standard library's std::error::Error trait. crates.io
  • log: A Rust library providing a lightweight logging facade. [#logging] crates.io

Applications

  • Anyhow: Provides anyhow::Error, a trait object based error type for easy idiomatic error handling in Rust applications. crates.io
  • color-eyre: An error report handler for panics and the eyre crate for colorful, consistent, and well formatted error reports for all kinds of errors. crates.io
  • tokio: A runtime for writing reliable, asynchronous, and slim applications with the Rust programming language. [#async, #futures, #io, #non-blocking] crates.io
  • tracing: tracing is a framework for instrumenting Rust programs to collect structured, event-based diagnostic information. [#logging, #tracing, #metrics, #async] crates.io
  • fs-err: fs-err is a drop-in replacement for std::fs that provides more helpful messages on errors. [#logging, #tracing, #metrics, #async] crates.io
  • clap: Command Line Argument Parser for Rust. [#parser, #argument, #cli, #parse, #arg] crates.io
  • env_logger: Implements a logger that can be configured via environment variables. [#log, #logging, #logger] crates.io
  • dirs: A tiny low-level library that provides platform-specific standard locations of directories for config, cache and other data on Linux, Windows, macOS and Redox. [#basedir, #xdg, #path, #app_dirs, #folder] crates.io
  • directories: A tiny mid-level library that provides platform-specific standard locations of directories for config, cache and other data on Linux, Windows and macOS. [#basedir, #xdg, #path, #app_dirs, #folder] crates.io

Domain

Backend

  • reqwest: An ergonomic, batteries-included HTTP Client for Rust. [#client, #request, #http] crates.io
  • hyper: A fast and correct HTTP implementation for Rust. [#hyper, #http, #hyperium] crates.io
  • H2: A Tokio aware, HTTP/2 client & server implementation for Rust. [#http, #async, #non-blocking] crates.io

Gui

Game

Build

  • bindgen: bindgen automatically generates Rust FFI bindings to C (and some C++) libraries. [#bindings, #ffi, #code-generation] crates.io
  • cc: A library to compile C/C++/assembly into a Rust library/application. [#build-dependencies] crates.io

Test

  • insta: Snapshots tests (also sometimes called approval tests) are tests that assert values against a reference value (the snapshot). [#testing, #snapshot, #approval, #jest] crates.io
  • Fake: A Rust library for generating fake data. [#random, #data, #generator, #faker] crates.io
  • wiremock: wiremock provides HTTP mocking to perform black-box testing of Rust applications that interact with third-party APIs. [#mock, #black-box, #http, #mocking, #test] crates.io
  • Mockall: A powerful mock object library for Rust. [#testing, #mock, #mocking] crates.io
  • criterion: Criterion.rs helps you write fast code by detecting and measuring performance improvements or regressions, even small ones, quickly and accurately. [#benchmark, #criterion] crates.io

Macro

  • syn: Syn is a parsing library for parsing a stream of Rust tokens into a syntax tree of Rust source code. crates.io
  • quote: This crate provides the quote! macro for turning Rust syntax tree data structures into tokens of source code. crates.io
  • proc-macro2: A wrapper around the procedural macro API of the compiler's proc_macro crate. [#macros] crates.io
  • paste: Provides a flexible way to paste together identifiers in a macro, including using pasted identifiers to define new items. crates.io

Cargo

  • cargo-edit: This tool extends Cargo to allow you to add, remove, and upgrade dependencies by modifying your Cargo.toml file from the command line. crates.io
  • cargo-outdated: A cargo subcommand for displaying when Rust dependencies are out of date. crates.io
  • cargo-update: A cargo subcommand for checking and applying updates to installed executables. crates.io
  • cargo-expand: Once installed, the following command prints out the result of macro expansion and #[derive] expansion applied to the current crate. crates.io