Repository files navigation A Short, Handpicked List of Rust Crates
cargo add anyhow - Keeps application error handling concise while preserving context and source chains.
cargo add thiserror - Produces idiomatic typed errors without handwritten Display and Error implementations.
cargo add duplicate - Removes repetitive declarations when declarative macros alone become verbose.
Collections and Iterators
cargo add dashmap - Allows concurrent map access without wrapping a HashMap in one global lock.
cargo add indexmap - Preserves deterministic insertion order while retaining hash-table lookups.
cargo add itertools - Makes complex iterator pipelines shorter and more expressive.
Initialization and Shared State
std
crate
advantage
std::cell::{OnceCell, LazyCell}
once_cell::unsync::{OnceCell, Lazy}
Avoids an external dependency for single-threaded one-time initialization.
std::sync::OnceLock
once_cell::sync::OnceCell
Avoids an external dependency for thread-safe one-time initialization.
std::sync::LazyLock
once_cell::sync::Lazy
Avoids an external dependency for thread-safe lazy initialization.
cargo add arc-swap - Avoids read-side locking when shared Arc values are read frequently and replaced occasionally.
cargo add uuid --features v4,fast-rng - Provides standards-compliant UUIDs with fast random v4 generation.
cargo add short-uuid - Produces compact, reversible UUID strings for display and storage.
cargo add byteorder bytes - Combines explicit endian conversion with cheap, shareable byte buffers.
cargo add num_enum - Eliminates handwritten checked conversions between primitives and enum variants.
cargo add strum --features derive - Generates parsing, display, iteration, and metadata code for enums.
cargo add jiff --features serde - Prefer its robust time-zone-aware arithmetic and modern Temporal-inspired API.
cargo add time --features formatting,macros - Choose it when compact calendar types and formatting are sufficient.
cargo add rand - Prefer its broad RNG, distribution, and ecosystem support.
cargo add fastrand - Choose it for a tiny API and fast non-cryptographic random values.
cargo add rust_decimal - Prefer bounded fixed precision to avoid floating-point rounding in financial calculations.
cargo add bigdecimal - Choose arbitrary precision when values can exceed Decimal::MAX 7.92e28.
cargo add num-bigint - Removes integer size limits when values can exceed i128::MAX 1.7e38.
cargo add log --features release_max_level_info - Decouples libraries from a concrete logging backend.
cargo add env_logger - Adds lightweight logging controlled at runtime through environment variables.
cargo add regex - Prefer flexible, Unicode-aware matching with predictable worst-case search time instead of backtracking.
cargo add aho-corasick - Choose it to search for many literal patterns in a single pass.
cargo add alphanumeric-sort - Produces natural ordering such as item2 before item10.
Home and User Directories
std::env::home_dir() - Prefer this dependency-free option when only the current user's home directory is needed.
cargo add directories - Choose platform-native config, cache, data, and user directories without OS-specific code.
cargo add camino - Avoids repeated UTF-8 checks when application paths must be valid strings.
cargo add glob - Selects groups of filesystem paths concisely with familiar wildcard patterns.
Data Formats and Serialization
cargo add serde --features derive - Avoids format-specific conversion code through a shared derive-based data model.
cargo add serde_with - Handles awkward wire representations without custom serializer boilerplate.
cargo add serde_repr - Preserves numeric wire formats for fieldless enums with a derive.
cargo add serde_json - Reuses Serde models for fast, interoperable JSON conversion.
cargo add serde_json_path - Avoids manual tree traversal for complex JSON queries.
cargo add toml - Reuses Serde models for Rust-friendly TOML configuration files.
cargo add saphyr - Provides pure-Rust YAML 1.2 compliance for both parsing and emitting.
cargo add roxmltree - Prefer fast read-only traversal when the whole XML document fits in memory.
cargo add quick_xml - Choose streaming, writing, async I/O, or Serde support for larger workflows.
cargo add schemars - Keeps JSON schemas synchronized with Rust types through derives.
cargo add base64 - Provides configurable, allocation-aware Base64 encoding and decoding.
cargo add serde_urlencoded - Reuses Serde models for form and query encoding instead of manual key-value pairs.
cargo add calamine - Reads multiple spreadsheet formats without requiring Excel or native libraries.
cargo add rust_xlsxwriter --features zlib,ryu - Creates feature-rich XLSX files without requiring Excel.
cargo add envy dotenvy - Prefer this small combination for .env loading and typed environment configuration.
cargo add config --no-default-features --features convert-case,yaml - Choose it when multiple configuration sources need precedence and merging.
cargo add reqwest-middleware http-cache-reqwest - Adds reusable middleware and standards-aware caching to Reqwest clients.
cargo add cached - Removes memoization boilerplate through macros and ready-made cache stores.
cargo add rocksdb - Provides durable, high-throughput key-value storage without running a database server.
cargo add tokio-postgres --features with-serde_json-1,with-jiff-0_2 - Keeps PostgreSQL access lightweight and close to the native protocol.
cargo add deadpool-postgres - Adds async pooling and statement caching without changing tokio-postgres semantics.
cargo add postgres-from-row - Removes repetitive PostgreSQL row-to-struct extraction code.
cargo add postgres-types --features derive - Removes handwritten ToSql and FromSql implementations for custom types.
cargo add sqlx --features runtime-tokio,postgres - Retains direct SQL control while adding compile-time query validation and pooling.
cargo add jiff-sqlx --features postgres - Keeps Jiff types usable with SQLx without reverting to another date-time crate.
cargo add sea-orm --features sqlx-postgres,runtime-tokio,macros - Reduces CRUD and relationship boilerplate with an entity-based async ORM.
Async Runtime and Utilities
cargo add futures - Supplies runtime-neutral Future and Stream combinators shared across async ecosystems.
cargo add tokio --features full - Combines a mature scheduler, async I/O, timers, and synchronization in one runtime.
cargo add async-channel - Keeps multi-producer, multi-consumer channels independent of any async runtime.
cargo add rayon - Parallelizes iterator workloads with minimal code and work-stealing scheduling.
cargo add reqwest --features json,gzip - Combines ergonomic async HTTP with JSON and transparent gzip support.
cargo add scraper - Provides browser-grade HTML parsing and CSS selectors without browser automation.
cargo add axum - Uses Tower middleware and Rust types to keep web handlers modular and testable.
cargo add axum-extra --features typed-header - Avoids custom extractors for common typed Axum patterns.
cargo add tower-http --features cors - Adds reusable CORS middleware without custom Tower layers.
Authentication and Validation
cargo add jsonwebtoken - Provides interoperable JWT signing and verification across common algorithms.
cargo add validator --features derive - Keeps validation rules next to data types through derives.
cargo add alloy - Unifies Ethereum types, ABI handling, providers, and signing in a modular ecosystem.
cargo add anstream anstyle - Prefer automatic ANSI adaptation for TTY detection, color environment variables, and Windows consoles.
cargo add colored enable-ansi-support - Choose fluent string styling when explicit Windows ANSI setup is acceptable.
cargo add comfy-table - Builds readable, adaptive terminal tables with little formatting code.
cargo add crossterm --no-default-features --features events - Provides one terminal event and control API across Unix and Windows.
cargo add clap --features derive - Generates robust parsers, validation, and help text from typed derives.
cargo add dialoguer --no-default-features - Prefer focused prompts with flexible themes and minimal UI assumptions.
cargo add cliclack - Choose a cohesive, polished experience for multi-step command-line interactions.
cargo add indicatif - Adds efficient progress bars, spinners, and multi-progress rendering.
cargo add rfd --no-default-features - Opens native dialogs without committing the application to a full GUI toolkit.
cargo add sysinfo - Replaces platform-specific code with one API for broad system and process metrics.
cargo add num_cpus - Provides simple, infallible logical and physical CPU counts with affinity awareness.
cargo add netdev - Exposes richer network interface and address details than general system-information crates.
hashes - Provides a consistent family of pure-Rust cryptographic hash implementations.
cargo add pulsar --no-default-features --features tokio-runtime,compression - Integrates Apache Pulsar with Tokio while reducing payload size through compression.
cargo add polars --features parquet,lazy,is_in,rank,abs,streaming,cutqcut,propagate_nans - Accelerates columnar analytics with lazy optimization, streaming, and Parquet support.
cargo add ndarray --features rayon - Brings NumPy-like N-dimensional arrays with optional Rayon parallelism.
cargo add semver - Avoids incorrect version-string comparisons by implementing Semantic Versioning rules.
cargo add duct - Makes pipelines, redirection, and subprocess composition safer than shell strings.
cargo add ctrlc - Enables graceful shutdown without manual platform-specific Ctrl-C handling.
pyo3 - Shares Rust code with Python while retaining native performance and type safety.
You can’t perform that action at this time.