Let's list here crates that enhance Rust as a language.

It not "batteries" like in stdx, but Rust-specific crates for workarounds for various missing features and experimental ideals from non-accepted/postponed RFCs, or just hacky tricks.

The list is supposed to contain (mostly) crates that are internal to Rust, not ones for making Rust deal with "external world" like other languages bindings, file formats, protocols and so on.

Primary focus should be on crates that are not easy to find by conventional means (e.g. no algorithm name, format or protocol to search for).

Note that quality of the listed crates may vary from proof-of-concept to stable-and-widely-used.

Procedural macros and custom derive:

auto-impl - Derive Box (and other pointers) wrappers with all methods delegated.

(and other pointers) wrappers with all methods delegated. derive_more - derive standard traits like Add or Index that lack built-in derive.

or that lack built-in derive. enum-primitive-derive, derive_builder, strum, enum-unitary - derivers for enums; enum-map - "map literal" macro for enums.

smart-default - #[derive(Default)] with your default values.

with your default values. derivative - Some additinoal derives and adjustable analogues of std derives. Debug with ignored fields, Clone with overridden clone function, Default with alternative value like in smart-default.

with ignored fields, with overridden clone function, with alternative value like in smart-default. couted-array - Automatix size for constant fixed size arrays before RFC 2545 goes in.

sugar-rs - List comprehensions, hashmap construction.

match_all - A match-like block that executes multiple branches if needed.

if_chain - A macro crate that makes embedding a lot of if let nicer. Related: guard for if !let or Swift's guard let .

nicer. Related: guard for or Swift's . delegate - Proxy struct methods to a field.

overflower - proc macro that lets you annotate a function to make arithmetic operations in it wrapping, saturating or panicking.

def_mod - forward declare mod 's interface, asserting that implementation (included by specifying #[path] based on #[cfg] ) matches the declared interface.

's interface, asserting that implementation (included by specifying based on ) matches the declared interface. derive_utils - helpers for implementing your own custom derive / macros for enums.

interpolate - string interpolation: let world = "world."; s!("Hello, {world}")

taken - Sugar for let x = x; or let y = y.clone(); , for use in closures.

or , for use in closures. momo - a prototype of automatic introduction of dynamic dispatch in a function using proc macro.

ifmt - "inline string {interpolation}"

shrinkwraprs - Create Newtype(u32) , automatically implementing traits to make as convenient as original type.

, automatically implementing traits to make as convenient as original type. custom_debug_derive - Derive Debug with a custom format per field.

cxx - Generates a bridge between C++ and Rust based on schema defined in Rust code.

genawaiter - generators for stable Rust. 3 Types.

auto_enums - allow multiple return types by automatically generated enum.

vecmerge - merge compile-time-known slices of vector literals using + sign.

sign. log-derive - auto insert logging for functions

cascade - cascade expressions - multiple actions on one object.

overloadable - macro function overloading.

include-flate - compress literal inlucde_str! / include_bytes! buffer before compilation, lazily decompress in runtime.

/ buffer before compilation, lazily decompress in runtime. ambassador - Delegate trait implementations

Testing-related

test-case-derive - Nightly-only. Allows adding arguments to test functions and listing sets of inputs in attributes.

quickcheck, proptest - Fuzz testing. Also mutagen for alternative test coverate method.

mockiato - Mocking of traits: .expect_myfunc(...).times(2).returns(...)

loom - test concurrent code

Threading and sleeping:

spin_sleep - precise sleep.

desync Desync<T> where you can post operations to be executed, maybe in background. Alternative approach to threading/syncronosation.

where you can post operations to be executed, maybe in background. Alternative approach to threading/syncronosation. crossbeam, rayon - Advanced threading.

parking_lot - Synchronisation primitives (Mutex, RwLock, Once) speed up.

atomic - generic Atomic<T> type.

type. arc-swap - Arc meets AtomicPtr - Like crossbeam::ArcCell or optimized Mutex<Arc<...>> . Readers don't block.

meets - Like or optimized . Readers don't block. atomic_refcell - Threadsafe RefCell .

. arbalest - Like Arc<AtomicRefCell<T>> , but without some runtime check.

, but without some runtime check. qcell - Less flexible, but statically checked RefCell analogue. QCell , LCell , TCell with detached owners for borrowing.

analogue. , , with detached owners for borrowing. flume - mpsc channel, competes with std and crossbeam's.

bus - spmc broadcast lock-free channel.

swym - transactional memory

conquer-once - lazy and one-time initialisation, including for nostd

General list:

rental - Deal with self-referential structs. Related: owning_ref.

take_mut, replace_with - Apply Fn(T) -> T to &mut T .

to . type_num / peano - Simulate missing type-level integers.

slice - Make a "view" into a Read+Write+Seek with offset and length.

mopa - implement customized Any-like trait with your own additional methods. See also: query_interface.

streaming_iterator - like Iterator, but with another ownership rules.

num, num_traits, alga - Traits for denoting algebraic properties of things and other math; rug - long arithmetic (bigint and friends); caldyn - evaluate strings like "2+2" ; nalgebra - linear algebra.

; nalgebra - linear algebra. failure, error_chain - Dealing with errors in more organized way.

downcast-rs, vec_box, traitobject - Tricks with trait objects.

optional - a space efficient Option replacement. Related: nanbox.

replacement. Related: nanbox. lazy_static - declaring lazily evaluated statics (global variables). See also: core_memo.

bytes, byteorder - Work with byte arrays (big-endian/little-endian).

static_assertions - compile-time assertions.

reflect - A proof-of-concept for making Java/Go-like reflections in Rust using procedural macros.

boolinator - Option or Result -style methods for bool . Also there's crate bool_ext .

or -style methods for . Also there's crate . noisy_float - Floats that panic on NaN.

decorum - Ordered , NonNan and Finite wrappers for floats.

, and wrappers for floats. smallvec - On-stack small vectors. Tuner: smallvectune.

array_tool - More methods for arrays and strings, including a Unicode grapheme iterator .

. nom, combine, lalrpop - parser combinators

serde - serialization

mitochondria - MoveCell and OnceCell . Also: once_cell, lazycell.

and . Also: once_cell, lazycell. either - Like Result , but without error semantics.

, but without error semantics. coalesce - Join mismatched if / match branches based on enum, alternative to usage of a trait object. See also: impl_sum. See also: auto_enums

/ branches based on enum, alternative to usage of a trait object. See also: impl_sum. See also: auto_enums const-concat - A concat! that accepts non-literal strings.

that accepts non-literal strings. void - A crate with a "canonical" uninhabited (zero, bottom) type, to use instead of the ! never type before it goes stable.

never type before it goes stable. itertools - More iterator adapters like and related functions like unfold .

. reexport-proc-macro - Re-export a custom derive.

array-macro - Like [42; 3] array literal, but with some restrictions removed.

array literal, but with some restrictions removed. m - pure Rust "libm" - primitive mathematical functions for nostd.

interpolate_idents - more powerful concat_idents! .

. null-terminated - NULL-terminated arrays for C interop.

bus - Single writer, multiple reader broadcast lockfree communication channel. std::io::{Read,Write} wrapper: bus-writer.

wrapper: bus-writer. frunk - Functinal programming toolkit: HList (heterogenous list of cons cell), Coproduct for ad-hoc enums, Semigroup/Monoid like in alga above.

(heterogenous list of cons cell), for ad-hoc enums, Semigroup/Monoid like in above. fragile - Fragile<T> and Sticky<T> wrappers for sending non- Send things across threads.

and wrappers for sending non- things across threads. double - mocking (mock testing) library.

joinery - join_with for joining to a string with separators from an Iterator.

for joining to a string with separators from an Iterator. pipe - Generate a byte stream-based pipe, like std::sync::mpsc , but for bytes. Combined with my crate readwrite you can make it bi-directional, like a socket. Also newer crate duplexify.

, but for bytes. Combined with my crate readwrite you can make it bi-directional, like a socket. Also newer crate duplexify. uninitialized - Choose std::mem::zeroed or std::mem::uninitialized based on Cargo feature flag.

or based on Cargo feature flag. failsafe - wrap function in a supervisor that prohibits execution (returns error early) for some time in case of consequtive failures of the wrapped function. Also recloser.

corona - stackful coroutines.

subtle - constant-time primitive ops for crypto

ctor - life before main() - auto-initialization of things before main() using linker tricks.

- auto-initialization of things before using linker tricks. inventory - Typed distributed plugin registration using ctor crate above.

crate above. strfmt - Like format!() , but with dynamically specified format string and your hashmap for available variables.

, but with dynamically specified format string and your hashmap for available variables. panic-never - Panic handler for no_std code that causes linker error if panics are not statically excluded from your code.

stdio-override - Override std::io::std{in,out,err} using dup2 on Unix.

using on Unix. bstr - Text processing methods for UTF-8-esque byte strings.

async-trait - Traits for async fn using dynamic dispatch. See also https://crates.io/crates/real-async-trait. See also: polling-async-trait, async-trait-ext

using dynamic dispatch. See also https://crates.io/crates/real-async-trait. See also: polling-async-trait, async-trait-ext pow - insert proof-of-work requirements using serde

zerocopy - Utilities for zero-copy parsing and serialization

scopeguard - defer! , defer_on_unwind! , defer_on_success! .

, , . bytemuck - Zeroable , Pod (plain old data) trait, safe reinterpret_cast s for some types.

Allocation or data structures:

slab - Hands out integer handles instead of actual pointers. My own additions: slab_typesafe, compactmap.

non-empty, vec1 - A non-empty vector or maybe other things. See also a reddit thread.

lru_time_cache - A cache. timed_cache - another cache.

uluru - Another LRU cache.

im, rpds - Immutable collection data types.

fst - Specialized compact data structure for pre-ordered data.

internment - Interning strings or data. Stores data permanently/to Rc/to Arc and gives a handle. Same data => same handle.

tendril - compact string/buffer type, optimized for zero-copy parsing.

slotmap - like slab, but handles are protected against accidental reuse (there is counter inside).

froggy - like slab, but with iteration, reference counting and weak pointers.

containers - containers like in std, but with fallible allocation and custom allocators.

sdset - A wrapper around a sorted+deduplicated slice providing faster set operations (union, intersection, etc.).

intrusive-collections - no_std single- and double-linked lists, red-black tree without allocating dedicated memory for them, but by attaching things to contained objects instead.

phf - compile-time-constructed static perfect hash table maps and sets.

generational-arena - Safe allocator with deletions.

rctree - DOM-like tree with ordered children, parents and siblings, based on strong and weak Rc links.

heapless - allocation-free data structures: fixed-size vec, priority queue, hash table/set.

voluntary-servitude - thread-safe appendable list with lock-free iterator.

copyless - Pre-allocate Box or Vec entry to fill it in later. Also maybe prevents extra memcpy call.

call. ccl - Fast concurrent hashmap and timed cache, also for no_std. See also dashmap and chashmap . shard_lock .

and . . contrie - Lock-free concurrent map and set with interface similar to HashMap.

Evmap - A lock-free, eventually consistent, concurrent multi-value map.

sharded_slab - Slab mutable without exclusive access, lockfree

arrayvec - Array-backed fixed-capacity vector

vec-utils - map and zip vector while reusing allocation.

elsa - append-only collections for getting references to elements. Insertion does not require exclusive ( &mut ) access.

) access. shawshank - generic internment.

concache - Two fast concurrent shared hash maps.

hashcow - Hash table with copy-on-write for storing duplicated data.

Cargo-specific or code analysers:

Hosted languages designed to interoperate with Rust

Rhai - small, inspired by Chai.

Rune - async-friendly

Dyon

Unsorted links dump

(to be moved up and described properly)

https://www.reddit.com/r/rust/comments/by9ld5/numeric_literals_01_easily_cope_with_numeric/

https://www.reddit.com/r/rust/comments/bxsokc/public_release_of_warnalyzer_to_scan_multicrate/

https://www.reddit.com/r/rust/comments/bucriz/nameof_crate_provides_a_macro_akin_to_cs_nameof/

https://www.reddit.com/r/rust/comments/btwmc7/my_second_crate_leg_elegant_logging_made_simple/

https://www.reddit.com/r/rust/comments/btr1x5/vecmerge_a_macro_for_merging_vectors/

https://www.reddit.com/r/rust/comments/bstv3q/ccl_the_fastest_concurrent_hashmap_yet/

https://github.com/dtolnay/select-rustc

https://github.com/japaric/cast.rs

https://github.com/interact-rs/interact

https://docs.rs/slice-group-by/0.2.4/slice_group_by/

https://github.com/JoshMcguigan/multi_try

sccache

https://www.reddit.com/r/rust/comments/bx75zh/once_cell_021_100_macrofree_lazystatic/

https://www.reddit.com/r/rust/comments/bwr2yg/the_design_and_implementation_of_a_lockfree/

https://docs.rs/rusty-fork/0.2.2/rusty_fork/

https://www.reddit.com/r/rust/comments/c1c0ez/traitcast_dynamically_cast_from_dyn_any_to/

https://crates.io/crates/state

https://crates.io/crates/powerset-enum

https://www.reddit.com/r/rust/comments/c9iltj/announcing_hazptr_dynamic_lockfree_memory/

https://github.com/chris-morgan/anymap

https://www.reddit.com/r/rust/comments/cfn0u2/show_rrust_treelike_implement_content_and/

https://github.com/praezi/rust/ - global crates.io-wide callgraph attempt

https://blog.trailofbits.com/2019/07/01/siderophile-expose-your-crates-unsafety/

https://crates.io/crates/prettytable-rs

https://gist.github.com/est31/3d9e880be746c3a443c699d9ff1888d2 - cargo-udeps unused deps

https://docs.rs/ordered-float/0.5.0/ordered_float/struct.NotNaN.html

https://www.reddit.com/r/rust/comments/d0vu1s/cargowalk_run_a_command_for_each_package_root/

https://www.reddit.com/r/rust/comments/dknbys/my_tool_to_analyse_how_stack_trace_changes_during/

https://crates.io/crates/const_env

https://www.reddit.com/r/rust/comments/dr3ktd/cargohack_a_tool_to_work_around_some_limitations/

https://lib.rs/crates/lts

https://crates.io/crates/accurate

pin-cell

uom - units of measurements

https://github.com/pitdicker/valet_parking - nostd thread parking

https://github.com/o0Ignition0o/cargo-scout - run clippy on diffs

lazy_format

stowaway - pack data into pointers

fasteval - math expressions eval with compiling and user-defined functions

faux - mocking for testing without traits

alias - mutate data while aliased

trapper - allows for the creation of transparent type wrappers

cow_utils - partially zero-alloc string operarions like to_lower or replace.

pointer_utils

tap - run closure on something, then return it

quit - exit process with a specified code, but also running destructors on the way

https://neosmart.net/blog/self-compiling-rust-code/ - shell script header for running Rust file

https://github.com/maciejhirsz/beef - Copy-on-write for strings that is smaller size

typic - embed memory layout information into type system

Unshared or SyncWrapper trick to take away &self and give Sync .

or trick to take away and give . hibitset - Like HashSet<u32> , but with optimised storage

, but with optimised storage https://github.com/dureuill/questionmark - alternative std::ops::Try trait proposal

trait proposal waitmap - A map that you can asyncly await if there is no entry you need in it yet.

fail - inject errors for testing

slice_as_array

ufmt - a smaller, faster and panic-free alternative to core::fmt

archery - Abstract over the atomicity of reference-counting pointers in rust

https://github.com/llogiq/momo - transparently turn generic into dynamic to reduce compile time

https://crates.io/crates/os_str_bytes

logos - lexer proc macro

https://docs.rs/enum_dispatch/0.3.0/enum_dispatch/

watt - WebAssembly-driven proc macros

https://crates.io/crates/structural - structural typing

https://crates.io/crates/and_then_some - Provides an extension trait for bool with methods that return Option<T> .

. https://github.com/Xaeroxe/c-closures-rs/ - Closures between C and Rust

https://docs.rs/safe_arch/0.3.1 - various tricky CPU-specific instructions like AVX or SSE

https://docs.rs/wide/0.4.6/wide/ - SIMD-y types for packed sets of numbers with some functions on it

https://crates.io/crates/getset - generate getters and setters

https://crates.io/crates/duplicate - general purpose code duplicator as a proc macro

https://github.com/rodrimati1992/abi_stable_crates - proc macro to have more rusty rust-to-rust stable ABIs

https://docs.rs/drop_bomb/0.1.4/drop_bomb/ - panic on drop (unless explicitly defused) - linear types?

https://crates.io/crates/humpty_dumpty - proc macro, define types that cannot be implicitly dropped except in controlled situations.

https://crates.io/crates/apply A tiny library for chaining free functions into method call chains.

https://docs.rs/defer-drop/1.0.0/defer_drop/ - drop things in background thread

https://github.com/frewsxcv/cargo-all-features - build and test all Cargo features combinations

https://github.com/jojolepro/partialfunction - piecewise functions helpers + macro for nice syntax

https://github.com/doctorn/trait-eval - Demonstrates possibility of trait bounds-based compile time programming

https://github.com/jswrenn/typic - Type-safe transmutations between layout-compatible types.

https://crates.io/crates/reffers - Additional smart pointers, ARef, custom Rc/Arc, other tricks like RMBA or Bx

https://docs.rs/easy-parallel/3.0.0/easy_parallel/ - alternative interface for scoped threads

https://crates.io/crates/tearor - TearCell - "atomic" cell that can hold large amount of POD, at expence of consistency.

iter_read - Iterator<Item=u8> to impl Read

safer_ffi

rust_swig - like cxx, but also for Java

https://github.com/mgattozzi/gemini - proc macro to choose sync vs async interface

more fuzz checking: https://github.com/loiclec/fuzzcheck-rs https://github.com/microsoft/lain https://github.com/rust-fuzz/auto-fuzz-test

https://crates.io/crates/tramp - Trampoline for recursive functions, with support for mutual recursion

float_eq

https://crates.io/crates/print_bytes - Display file paths (or other bytes) optionally converting to lossy Unicode depending on platform?

doc-comment - load documentation for items from external files

https://github.com/jonhoo/griddle - hashbrown::HashMap with incremental (instead of spiked) resizing at expence of throughput and memory.

flurry - A port of Java's java.util.concurrent.ConcurrentHashMap to Rust.

smol_str - Like String , but small about strings inlined. Also "smartstring". Support Serde. Also "tinystr". Also "smartstring".

, but small about strings inlined. Also "smartstring". Support Serde. Also "tinystr". Also "smartstring". https://crates.io/crates/secrecy - Prevent logging of some values, zeroize them on drop.

them on drop. https://crates.io/crates/compressed_vec

obfstr - UTF16 string literals. Compiletime string literal obfuscation for Rust.

persy.rs - single-file database

https://github.com/That3Percent/tree-buf - compressed serialisation

salsa-rs - A generic framework for on-demand, incrementalized computation.

pre - declaring and checking the assurance of precondition

rust-embed - in debug, load file from FS, in release, embed into executable

cargo-c - cbuild, cinstall. Expose C API in automatic way

async-rwlock An async reader-writer lock with a fair locking strategy

https://github.com/dtolnay/linkme - Distributed slice by using special linker sections on some platforms.

lifeline - depenency-injection-like thing for async channels

indoc - indended multiline string literals

"If you're looking to get structs (possibly dynamically sized) consider using zerocopy (or scroll, or structview). If you need to turn bytes into trivial types such as u16 or arrays thereof, use bytemuck (or safe-transmute)."

Please suggest additions, replacements or removals.