https://blessed.rs/crates Fork me on GitHub [rust-logo-] Blessed An unofficial guide to the Rust ecosystem Sections * Common + General + Error Handling + Logging + Language Extensions + System * Networking + Async Executors + HTTP + Websockets + gRPC * CLIs + Argument Parsing + Utility + Terminal Rendering * Concurrency + Data Structures What is blessed.rs? Compared to other programming languages such as Python and Go, Rust's standard library is very small, including only core data structures in the standard library with all other functionality farmed out to 3rd party ecosystem crates, and a common complaint from new Rust developers is that they don't know where to start: which crates they ought to use and which crates they ought to trust. This list attempts to answer those questions. Common Very commonly used crates that everyone should know about General General purpose Use Case Recommended Crates rand Random numbers De facto standard random number generation library split out from the standard library uuid UUIDs Implements generating and parsing UUIDs and a number of utility functions serde Serialization De facto standard serialization library. Use in (JSON, YAML, etc) conjunction with sub-crates like serde_json for the specific format that you are using. regex De facto standard regex library. Very fast, but does not support fancier features such as Regular backtracking. Expressions fancy_regex Use if need features such as backtracking which regex doesn't support tempfile Temporary files Supports both temporary files and temporary directories flate2 Gzip (de) Uses a pure-Rust implementation by default. Use compression feature flags to opt in to system zlib. time The original datetime crate which was split out of std pre-rust-1.0. Preferrable if covers your needs, but it's quite limited in what it provides. Time & Date chrono The most comphrehensive and full-featured datetime library, but more complex because of it. indexmap Insertion-ordered A HashMap that seperately keeps track of insertion map order and allows you to efficiently iterate over its elements in that order arrayvec Arrays that are ONLY stack-allocated with fixed capacity smallvec Stack-allocated Arrays that are stack-allocated with fallback to arrays the heap if the fixed stack capacity is exceeded tinyvec Stack allocated arrays in 100% safe Rust code but requires items to implement the Default trait. reqwest Full-fat HTTP client. Can be used in both synchronous and asynchronous code. Requires tokio HTTP Requests runtime. ureq Minimal synchronous HTTP client focussed on simplicity and minimising dependencies. Error Handling Crates for more easily handling errors Use Case Recommended Crates anyhow For Provides a boxed error type that can hold any error, and applications helpers for generating an application-level stack trace. For thiserror libraries Helps with generating boilerplate for enum-style error types. Logging Crates for logging. Note that in general you will need a seperate crate for actually printing/storing the logs Use Case Recommended Crates tracing Tracing is now the go-to crate for logging. Text-based logging log An older and simpler crate if your needs are simple and you are not using any async code. tracing Structured Tracing is now the go-to crate for logging. logging slog Structured logging Language Extensions General purpose utility crates that extend language and/or stdlib functionality. Use Case Recommended Crates once_cell Newer crate with more ergonomic API. On track to be incorporated into the standard library. Should be Lazy static preferred for all new projects. variable initialization lazy_static Older crate. API is less convenient, but crate is stable and maintained. itertools Iterator helpers A bunch of useful methods on iterators that aren't in the stdlib num Abstracting over Traits like Number, Add, etc that allow you write different number functions that are generic over the specific types numeric type byteorder Utility functions to convert between different Endian conversion endianness or read/write data with a specific endianness Bitflags bitflags Strongly typed bitflag types System For low-level interaction with the underling platform / operating system Use Case Recommended Crates Memory mapping memmap2 files The older memmap crate is unmaintained. libc Libc Bindings for directly calling libc functions. windows The official Microsoft-provided crate for interacting with windows APIs Windows (OS) winapi Older binding to the windows APIs. Unofficial, but more complete than windows-rs Networking TCP, HTTP, GRPc, etc. And the executors required to do asynchronous networking. Async Executors To do async programming using the async-await in Rust you need a runtime to execute drive your Futures. Use Case Recommended Crates tokio The oldest async runtime in the Rust ecosystem and still the most widely supported. Recommended for new projects. General purpose async-std A newer option that is very similar to tokio. Its API more closely mirrors the std library, but it doesn't have as much traction as Tokio. glommio io_uring Use if you need io_uring support. Still somewhat experimental but rapidly maturing. HTTP HTTP client and server libraries, as well as lower-level building blocks. Use Case Recommended Crates http Types & The `http` crate doesn't actually contain an HTTP Interfaces implementation. Just types and interfaces to help interoperability. hyper Low-level HTTP A low-level HTTP implementation (both client and Implementation server). Implements HTTP 1, 2, and 3. Requires the tokio async runtime. rustls A portable pure-rust implementation of TLS TLS / SSL rust-native-tls Delegates to the system TLS implementations on windows and macOS, and uses OpenSSL on linux. reqwest Full-fat HTTP client. Can be used in both synchronous and asynchronous code. Requires tokio runtime. surf HTTP Client Client that uses the async-std runtime rather than the tokio runtime. ureq Minimal synchronous HTTP client focussed on simplicity and minimising dependencies. axum A minimal and ergonomic framework. An official part of the tokio project. Recommend for most new projects. tide Similar to Axum, but based on async-std rather than tokio actix-web A performance focussed framework. All Rust frameworks are fast, but choose actix-web if you need the absolutely maximum performance. HTTP Server poem Automatically generates OpenAPI defintions. warp Very similar to axum but with a quirkier API. This is a solid framework, but you should probably prefer Axum unless you particular like the API rocket Focussed on ergonomics. This is a solid framework, however development has stalled. Avoid for new projects. Websockets This section includes libraries for you to use just websockets. However note that many of the HTTP server frameworks in the section above also support websockets Use Case Recommended Crates tungstenite-rs Low-level Low-level crate that others build on tokio-tungstenite If you are using the tokio executor General Purpose async-tungstenite If you are using the async-std executor gRPC Use Case Recommended Crates General tonic Purpose gRPC over HTTP/2 with full support for asynchronous code. Works with tokio CLIs Argument Parsing See argparse-benchmarks-rs for a full comparison of the crates mentioned here and more. Use Case Recommended Crates clap Fully-featured Ergonomic, supports everything, and is fast at runtime. However compile times can be slow lexopt Fast compile times, fast runtime, pedantic about correctness. API is less ergonomic Minimal pico-args Fast compile times, fast runtime, more lax about correctness. API is more ergonomic Utility Helpers that are often useful when implementing CLIs Use Case Recommended Crates globset Globbing High-performance globbing that allows multiple globs to be evaluated at once walkdir Basic recursive filesystem walking. Directory walking ignore Recursive filesystem walking that respects ignore files (like .gitignore) File watchexec watching Watch files or directories and execute a function when they change Terminal Rendering For fancy terminal rendering and TUIs. The crates recommended here work cross-platform (including windows). Use Case Recommended Crates termcolor Coloured Output Cross-platform terminal colour output Full TUI library crossterm Cross-platform terminal rendering and event handling Concurrency Data Structures Use Case Recommended Crates parking_lot Mutex std::mutex also works fine. But Parking Lot is faster. Atomic arc_swap pointer Useful for sharing data that has many readers but few swapping writers See conc-map-bench for comparative benchmarks of concurrent HashMaps. Concurrent dashmap HashMap The fastest for general purpose workloads flurry Particularly good for read-heavy workloads. See communicating-between-sync-and-async-code for notes on when to use async-specific channels vs general purpose channels. crossbeam_channel The absolute fastest channel implementation available. Implements Go-like 'select' feature. Channels flume Smaller and simpler than crossbeam_channel and almost as fast postage Channels that integrate nicely with async code Parallel rayon computation Convert sequential computation into parallel computation with one call - `par_iter` instead of `iter`