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.
- auto-impl - Derive
Box
(and other pointers) wrappers with all methods delegated. - derive_more - derive standard traits like
Add
orIndex
that lack built-in derive. - enum-primitive-derive, derive_builder, strum, enum-unitary - derivers for enums; enum-map - "map literal" macro for enums.
enumn
. - smart-default -
#[derive(Default)]
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. See also:derive-where
. - 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 forif !let
or Swift'sguard let
. - delegate - Proxy struct methods to a field. Also
ambassador
andportrait
. - 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. - 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;
orlet y = y.clone();
, 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. - 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.
- vecmerge - merge compile-time-known slices of vector literals using
+
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. - ambassador - Delegate trait implementations
- inline-proc - Procedure macros declared and used within the same crate.
#[inline_proc] mod ... { }
- field_names - Generate static array with field names for a struct.
- syn, quote, proc_macro2 - "Bread and butter" of proc macros. Lightweight alt:
venial
,myn
.
- auto_enums - allow multiple return types by automatically generated enum.
- coalesce - Join mismatched
if
/match
branches based on enum, alternative to usage of a trait object. - impl_sum.
- auto_enums
- trait-union
- 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.
dicetest
. - mockiato - Mocking of traits:
.expect_myfunc(...).times(2).returns(...)
- double - mocking (mock testing) library.
- faux - mocking for testing without traits
- mockall -
#[automock]
for traits and other mocking - loom - test concurrent code. Also
shuttle
. - insta - snapshot/approval tests helper
- spin_sleep - precise sleep.
- desync
Desync<T>
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. - arc-swap -
Arc
meetsAtomicPtr
- Likecrossbeam::ArcCell
or optimizedMutex<Arc<...>>
. Readers don't block. See also: sync_cow - atomic_refcell - Threadsafe
RefCell
. - arbalest - Like
Arc<AtomicRefCell<T>>
, but without some runtime check. - qcell - Less flexible, but statically checked
RefCell
analogue.QCell
,LCell
,TCell
with detached owners for borrowing. - flume - mpsc channel, competes with std and crossbeam's. Supports async (including mixing it with sync). Also
mp2c
. Alsopostage
. Alsoloole
. - bus - spmc broadcast lock-free channel.
- conquer-once - lazy and one-time initialisation, including for nostd
- swym - transactional memory.
- stm-core - Clojure-like software transaction memory in Rust.
TVar
,atomically
. - lever - STM primitives, also some key-value tables
- rental - Deal with self-referential structs. Related: owning_ref - deemed unsound. Related: ouroboros. Related: fortify. Related: yoke. Related: nolife. Related: selfref, broption. self_cell also may be relevant.
- take_mut, replace_with - Apply
Fn(T) -> T
to&mut T
. - 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. - 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. - lazy_static - declaring lazily evaluated statics (global variables). See also: core_memo.
- bytes - Byte array, like subsliceable
Arc<Vec<u8>>
. Tools:bytes_utils
,input_buffer
,bufsize
. - byteorder - io::{Read,Write} for big-endian/little-endian numbers.
- static_assertions - compile-time assertions.
- reflect - A proof-of-concept for making Java/Go-like reflections in Rust using procedural macros.
- boolinator -
Option
orResult
-style methods forbool
. Also there's cratebool_ext
. - noisy_float - Floats that panic on NaN.
- decorum -
Ordered
,NonNan
andFinite
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. Utils:
serde_with
crate. - mitochondria -
MoveCell
andOnceCell
. Also: once_cell, lazycell, takecell forTakeCell
andTakeOwnCell
. - either - Like
Result
, but without error semantics. - const-concat - A
concat!
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. - 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. - m - pure Rust "libm" - primitive mathematical functions for nostd.
- interpolate_idents - more powerful
concat_idents!
. Also paste. - null-terminated - NULL-terminated arrays for C interop.
- bus - Single writer, multiple reader broadcast lockfree communication channel.
std::io::{Read,Write}
wrapper: bus-writer. - frunk - Functinal programming toolkit:
HList
(heterogenous list of cons cell),Coproduct
for ad-hoc enums, Semigroup/Monoid like inalga
above. - fragile -
Fragile<T>
andSticky<T>
wrappers for sending non-Send
things across threads. - joinery -
join_with
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. - uninitialized - Choose
std::mem::zeroed
orstd::mem::uninitialized
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. Also
coro
. - subtle - constant-time primitive ops for crypto
- ctor - life before
main()
- auto-initialization of things beforemain()
using linker tricks. Also https://crates.io/crates/startup . - inventory - Typed distributed plugin registration using
ctor
crate above. - strfmt - Like
format!()
, 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. Also
no-panics-whatsoever
. - stdio-override - Override
std::io::std{in,out,err}
usingdup2
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 - 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, safereinterpret_cast
s for some types.
- 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. Also cached even has
#[cached]
for memoized functions. Alsoschnellru
. - 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. See also: lasso
- 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. Like slotmap. Also
thunderdome
. - 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. - ccl - Fast concurrent hashmap and timed cache, also for no_std. See also
dashmap
andchashmap
.shard_lock
. - 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. Store indirected (Box
/Vec
/String
) data and hold shared references across insertions. - shawshank - generic internment.
- concache - Two fast concurrent shared hash maps.
- hashcow - Hash table with copy-on-write for storing duplicated data.
- coca - Data Structures with Constant Capacity.
- inplace_it -
inplace_or_alloc_array
Place small arrays on the stack. - la-arena - simple Vec-based deletion-less arena
cargo bloat
- Show what takes space in your binarycargo license
, cargo-lichking - List all dependencies by licence.cargo outdated
- Show which packages have newer version available.cargo clippy
- Additional warningscargo fmt
(rustfmt) - Automatically format the code. Also installable by rustup.cargo geiger
- Measure "unsafeness" of the project by counting expressions inunsafe{}
blocks and other unsafe things. Prototype: cargo-oshacargo make
- Define and run targets in a toml file like in Makefile.cargo add
,cargo rm
and so on - Manage dependencies from command line.cargo tarpaulin
- code coverage for tests.cargo asm
- display the assembly or llvm-ir generated for Rust source code (a single function can be specified).cargo audit
- Scan dependencies (Cargo.lock
) for reported security vulnerabilities.cargo expand
- Show source code as one big file with expanded macros, like ingcc -E
.- rustig - Show places where your program can theoretically panic.
cargo cache
- Shows disk size of Cargo cache and allows cleaning it.cargo web
- Client-side web for Rust (wasm?).cargo tally
- Plot reverse dependencies over time.cargo rerast
- Applycargo fix
-like modifications according to specifiable rules.- cargo-workspaces
- https://github.com/Areredify/srcfiles - list source files used in compilation
- cargo-incversion - Increment version in
Cargo.toml
from CLI cargo typesize
- list type and their byte sizes, ordered- https://github.com/ferrous-systems/cargo-review-deps - view code diff when updating a dep
- https://github.com/taiki-e/cargo-hack -
--each-feature
,--feature-powerset
,--version-range
- cargo quickinstall, cargo bininstall - repositories for pre-built executables
- https://crates.io/crates/cargo-pgo - automate/help using profile-guided optimisation / BOLT in Rust
- Rhai - small, inspired by Chai.
- Rune - async-friendly
- Dyon
- Mun
https://www.boringcactus.com/2020/09/16/survey-of-rust-embeddable-scripting-languages.html
(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. Also cargo-machete for other, simpler approach.
- 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
- 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
orSyncWrapper
trick to take away&self
and giveSync
.- hibitset - Like
HashSet<u32>
, but with optimised storage - https://github.com/dureuill/questionmark - alternative
std::ops::Try
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. See also:
orion_cfmt
- use C's formatting (snprintf
) from Rust conveniently. - 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. See also https://github.com/LyonSyonII/akin .
- https://github.com/rodrimati1992/abi_stable_crates - proc macro to have more rusty rust-to-rust stable ABIs. There is also
cglue
for trait object only.async-ffi
,dyntable
,thin_trait_object
,vtable
. https://github.com/outfoxxed/dyntable/blob/master/COMPARISON.md - 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. Also
maybe-async
. - 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". - https://crates.io/crates/secrecy - Prevent logging of some values,
zeroize
them on drop. - https://crates.io/crates/secret_integers - constant-time arithmetic for integeres
- 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
- fast-floats -
-ffast-math
simulation on nightly rust - u2size - double word integral type, with some operations
- https://github.com/TyOverby/Bark - like
Rc<T>
orArc<T>
- there are both counters. Unmaintained? - const_format. Compile-time string formatting. E.g.
concatcp
concatenates&'static str
s. fs-err
- Likestd::fs
, but with nicer error messages mentioning file paths- vptr - thin trait objects by embedding vtage pointer in the struct
- dangerous, untrusted - somehow deal with parsing untrusted input.
- https://docs.rs/stable_deref_trait/1.2.0/stable_deref_trait/trait.StableDeref.html
- resister - A collection of helpful iterator adaptors for iterating over
Result<T, E>
. - duct - a library for running child processes.
- normpath - Normalize filesystem path. Like canonicalisation, but without
\\?\
. - https://github.com/djmcgill/rich_phantoms - An implementation of phantom types in rust with control over variance and inheritance of send/sync.
- dyn-clone, dyn-clonable
- https://crates.io/crates/postfix-macros
- enumx, cex - Ad-hoc enums, checked exceptions emulation
- https://crates.io/crates/drop-bin - a place to move objects, deferring their Drop. E.g. to move things to other thread, away from the hot path, and rate-limit the drops there.
- act-zero - actors
- https://crates.io/crates/continuation - simulate try/catch or setjmp/jongjmp with call_with_escape_continuation and call_with_repeat_continuation
- gridly - managing fixed-size discrete 2D spaces. Grids, cardinal directions, etc.
- https://github.com/jonhoo/left-right - synchronisation primitive that keeps two copies of the data - for reading and for writing
- context_allocator - Memory allocation for no_std and other custom things.
MemorySource
trait. - static-alloc - Bump allocator for turning a static bytes array into a global allocator
- uninit -
&out
references and other tools for working with uninitialized memory - accurate - more precise or exact algorithms (sum, dot product) for floats (without arbitrary precision)
- https://github.com/Voultapher/once_self_cell Special cell for self-referential structs, Also
self-cell
- https://github.com/dureuill/sc - lifetime-erased reference. Weak ananlogue of the
&
reference. - https://docs.rs/stackbox - README states that it's a "stack-allocated Box", but I don't understand this thing myself enough to describe it here
- https://crates.io/crates/countme - library to organize counting of current, maximum and total number of instances of a type.
- bacon-sci - math: automatic differentiation, algorithms on polynoms, numeric differential equations solver, etc.
- https://github.com/jam1garner/rust-dyn-call - Call Rust function by name using linker-specific, platform-dependent magic.
- aquamarine - diagrams in rustdoc
- https://www.reddit.com/r/rust/comments/l3bley/delaytimer_v020_release_to_cratesio_cycle_task/ - cron-like scheduled tasks with limits and other timer things
- socket2 - Said to be better
std::net
, successor of depreactednet2
crate. Utilities for handling sockets. - https://github.com/fancy-regex/fancy-regex - regular expressions with more features than typical Rust regex
- https://docs.rs/bumpalo-herd/0.1.1/bumpalo_herd/ - bumpalo + Sync. Bumpalo is a simple allocator with no-op free.
- https://docs.rs/internal-iterator - internal iterator
- https://www.reddit.com/r/rust/comments/lj8sxh/announcing_diplomaticbag_a_library_that_lets_you/ - Give
Send
to!Send
things by ensuring that they stay on a dedicated thread and using closures everywhere. https://crates.io/crates/send_wrapper - GiveSend
to!Send
by checking that accesses only happen from the correct thread, lest panicking. - https://docs.rs/core_extensions/0.1.20/core_extensions/index.html
- https://github.com/TedDriggs/darling - work with proc macro's attributes
- https://github.com/Manishearth/mitosis - spawn processes like threads, passing serializeable things into child proceses. Relies on initialisation routine and environment variables.
- soa, soa-derive - Struct of Arrays vs Array of Structs
- camino - UTF-8-restricted Path+PathBuf
- generic-vec
- mockalloc - Test correctness of allocations/deallocatios, both probaililistic lightweight mode and heavy-weight tracing mode
- https://crates.io/crates/adaptive-barrier - better std::sync::Barrier
- https://crates.io/crates/squash - a string with length on the heap to save memory
- https://github.com/tczajka/ibig-rs - long integer numbers
- want - like futures mpsc channel, but without excessive buffering
- https://docs.rs/eclectic/ - traits like
Collection
,Map
, etc. - cell-project or dioptre.
&Cell<Struct>
to&Cell<Field>
. - static_init - linker shenanigans to improve your singletons
- https://github.com/japaric/cargo-call-stack - calculate global stack size for nonrecursive programs
- https://crates.io/crates/project-uninit - projections for MaybeUninit
- petgraph, prepona
- https://docs.rs/arraygen/0.2.0/arraygen/ - proc macro that generates a function which returns selected struct fields as an array
- reciprocal - Prepare constant-time division by specifying the divisor, then apply it to
u64
s. - autocfg - A Rust library for build scripts to automatically configure code based on compiler support.
- tightness - A library to make refined newtypes with explicitly specified invariants to be checked. To help make invalid states unrepresentable. Also
prae
. - https://crates.io/crates/init_array - initialize an array using a function from index to element
- soak, soa-derive - struct of arrays
- cargo-sort - sort some things in Cargo.toml
- conread - concurrent data structures where readers don't get blocked by writers, at expence of additional memory
- serde-plain - primitive-only serialisation/deserialisation. Also plain enums
- cap - memory allocator wrapper that tracks and limits memory usage
- nonmax - like NonZero, but not max value
- schemars - JSON schema for Rust serde
- parse-size - read size strings like
2 MiB
into actual numbers - chicon -
Filesystem
abstraction trait, impls for SSHFS, S3 and some others. But tokio 0.1 - https://github.com/bahlo/sonyflake-rs - ID generator of time, machine ID and sequence number
- https://www.reddit.com/r/rust/comments/nwdyip/new_create_announcement_iterate/ - macro that provides lazy iterator of arguments, including subiterators
- https://github.com/matthieu-m/static-rc - Like Rc/Arc, but somehow counted statically at compile time, for data structures
- https://github.com/alekseysidorov/static-box - no-std boxed trait objects with your buffer. Requires nightly, soundness iffy.
- posish - cap-std's low-level syscalls crate
stackbox
-&own
ing references in stable Rust - no_std-friendly Boxwith_locals
- CPS sugar in Rust, to "return" values referring to locals.dyn_safe
- Explicity annotate and assert a trait as object-safe as a semver promise.moveit
- A library for safe, in-place construction of Rust (and C++!) objects. TheCtor
,CopyCtor
, andMoveCtor
traits. Uses pinning. Also has it's own StackBox.- xtra + spaad - Generate messages enum from API for actors.
- peekread -
std::io::Read
withpeek
andstarts_with
. - catty - like
futures::oneshot
, but said to be faster - ghost-cell - Compile-time zero-cost borrow-checking of aliased references
- secrets - Handling sensitive data so that it won't liger in memory too much or be accessible.
- arc_new_cyclic_n - like
Arc::new_cyclic
, but with multiple pointers - serde-rs/json#160 (comment) - parse huge JSON array
- ijson - Like serde_json::Value, but with interned strings.
- funty -
IsNumber
,IsFloat
,IsInteger
,IsUnsigned
,IsSigned
traits for primitive numbers. AlsoAtLeastWidth
,AtMostWidth
and so on. Traits are empty. - bare-io - no_std's
std::io
.bare_io::Error
has only static str, notdyn Error
. - https://crates.io/crates/pipette - closure-based pipelines like
pipe((10, |x|x*2, |x|x+4))
. Also https://crates.io/crates/apply - rc_event_queue - unbounded, mpmc/spmc, lock-free concurrent FIFO event queue
- https://crates.io/crates/derived/ - proc macro derives for getters/setters, also
Constdef
-Default
for const fns. - https://crates.io/crates/const_default
- From https://www.reddit.com/r/rust/comments/q1bhth/experiments_with_ptr_metadata_and_unsize/:
rattish
,thinnable
,erasable
,slice-dst
. - https://crates.io/crates/bronze_gc - garbage collector. Article: https://arxiv.org/pdf/2110.01098.pdf. But may be unsound.
- UniFFT - Generate Kotlin, Switft, Python and Ruby bindings for
Send
+Sync
Rust code using special IDL file. - konst, constmuck - additional const things and bytemuck for const world
- voladdress - wrapper for volatile addresses, for marking them as safe and unsafe individually for reading and writing.
- os_display - quote filenames and other tricky strings to display in console in a sane way, taking current OS into account
- https://crates.io/crates/async-alloc-counter
- https://github.com/baptiste0928/rosetta - providing strings in multiple languages, with formatting and compile-time checking. i18n l10n.
- stretto - cache, like Go's ristretto.
- deku - read and write structs with bitfields. Also
modular-bitfield
, alsobilge
. - threadfin - thread pool
- nslice - MinSlice with compile-time const minimum, also ExactSlice
- chumsky - paster combinator, to add list of nom, pom, pest and maybe some others
- concread - Copy-on-write data structures that allow multiple readers with transactions to proceed while single writers can operate. Analogues of BTreeMap, HashMap and a cache.
- tiptoe - Generic intrusive smart pointers for Rust. Like
Arc
, but with the couter within your struct. ForPin
things. No weak counter.borrow_pin_from_inner_ref
. - shlex - Split string to array like in posix shell
- indexmap - like hashmap, but iteration order is specified
- inert - lets you access non-Sync data in Sync context, hiding from the user anything that may not be sound to use when the value is shared. I don't understand what "neutralisation" means though
- callbag-rs - organize callbacks, like some other library recommends to do for JavaScript.
- castaway - Safe, zero-cost downcasting for limited compile-time specialization.
- unchecked_index - Use
[]
for unchecked indexing, movingunsafe
to wrapper creation. - trait_set - proc macro version of trait aliases
- leapfrog - fast concurrent hashmap data structure:
LeapMap
. Competitor offlurry
anddashmap
- https://crates.io/crates/parallel_vec - SOA struct of arrays, competitor of soa_derive. https://www.reddit.com/r/rust/comments/snff4o/parallelvec_a_succinct_transparent_soa_vec/
- rustix - posish's new name, now with other OSes
- https://crates.io/crates/document-features - proc macro to read special comments in
Cargo.toml
and generate documentation strings. - halfbrown - Hashmap implementation that dynamically switches from a vector based backend to a hashbrown based backend as the number of keys grows
- enum-assoc - Derive multiple functions returning constants specified in attributes for enum variants.
- https://crates.io/crates/try-drop -
TryDrop
with TLS-based choosable failure handling strategies - assay, a test macro that puts each test in its own process and filesystem.
- vcell -
VolatileCell
- Just like Cell but with volatile read / write operations. May be unsound. - hybrid-rc - Like
Rc
andArc
that are convertible between each other. - trait-enumizer - Bridge traits with methods and enums with variants together.
- thin_vec - like
Vec
, with capacity and length stored in allocated buffer, not in the handle itself. - https://github.com/ArtBlnd/rename-future - Transmute
async fn
's Future into something nameable. - https://crates.io/crates/sendable -
SendRc
- sendableRc
that stores thread id inside and requires "packing up" before sending. Does not requireSync
.SendOption
to have optional non-sendable data inside sendable things. - https://github.com/kprotty/usync - synchronisation primitives, competitor of
parking_lot
. - thingbuf - combination MPSC channel and buffer pool. Supports async. Can reuse allocations:
push_ref
/pop_ref
. - https://github.com/ibraheemdev/seize - Helper crate for implementing thead-safe memory reclamation. Like a temporary reference counting for pointers that are going away, to decide when to really deallocate.
- higher_order_closure -
for<'a> |x: &'a i32|
closures. - serde-this-or-that - weak typing for Serde, to automatically interpret
"True"
astrue
or33
as33.0
. See alsoserde-with
. - assert-unordered -
assert_eq!
for unordered collections - https://github.com/Gankra/abi-checker - slightly offtopc here: check which types work on ABI boundary with different compler combinations
- https://crates.io/crates/fast_fp -
-ffast-math
analogues off32
andf64
. Uses clang and requires cross-language LTO. - platforms, current_platform - programmatic access to Rust target triples, current one, their attributes like pointer width and support tier.
- ghost -
#[phantom]
proc macro to define your ownPhantomData
with your clauses and variance specifiers. - dilib - Dependency injection for Rust, runtime.
- https://docs.rs/compact_arena/latest/compact_arena/ - arena with limited number of elements, for compact indexes
- ghosts - types for dummied out code that should be only type-checked, not built
- sadness-generator - Various ways to crash the program (to test error reporting)
- signals2 - Qt-like signals and slots
- any_vec - Type-erased vector of unknown-, but same-typed elements, without extra indirection like with
Vec<Box<Any>>
. - entrait, unimock - Automatically derive trait from function signature, allowing dependency injection and mock testing. https://audunhalland.github.io/blog/entrait-pattern/
- sealed - sealed traits
- enum_map - A map with C-like enum keys represented internally as an array
- postcard - bincode alternative for serialisation, embedded-friendly and with COBS mode to avoid zero bytes
- flashmap - A lock-free, partially wait-free, eventually consistent, concurrent hashmap. Like evmap, but optimised for reading at expense of writing.
- lending_iterator
- https://docs.rs/fix-hidden-lifetime-bug - Something that deals with some obscure lifetime error message when dealing with async.
- assert2 - smarter
assert!
for tests, with printing of more things - rowan - A generic library for lossless syntax trees.
assert_let_bind
- uselet ... else
to allow bindings with incomplete matches in tests.assert_let!(Some(new_var), expr);
.- atomic_maybe_uninit, atomic_memcpy
- https://crates.io/crates/debug_unwraps - unwrap with assert on debug, unchecked_unwrap on release
- retriever - in-memory embedded NoSQL-eqsue data structure without persistence, with indexes and queries.
- slice-deque - double-ended queue / ring buffer with continuous memory slice interface using virtual memory tricks. Limited portability.
- https://crates.io/crates/peapod - struct-of-array approach at storing vector of enums, grouping tags together. Memory efficient storage for enum tags.
- zerovec - zerocopy vector
- databake - Serializes things by generating Rust code to be statically included to "bake" it into executable. See also
uneval
crate. carto vet
- tracking review/audit status for dependencies, including deltas.cargo crev
- similar, but global system with web of trust, without deltas though.cargo careful
- build program with debug-assertions-enabled libstd and execute tests- serde_transcode - turns
serde::Deserializer
toserde::Serialize
.cargo unlock
- likerm Cargo.lock
, but workspace-friendly. - argminmax - argmin/argmax for ndarray, SIMD-powered
- c_vec - Vector that is externally allocated (e.g. from C code), with its own slice and iterator types
- tryvial - try blocks on stable Rust using proc macro
- https://github.com/rust-secure-code/cargo-auditable - Embed dependency information into executables and check it for vulns
- presser - copy bytes to possibly uninitialized memory without undefined behaviour.
Slab
,copy_into_maybe_uninit_slice
. - enclose - Convenience macro to clone values into closures
- buffer-unordered-weighted -
StreamExt::buffer_unordered
with weights for limiting concurrency in a more smart way - deluge - like
StreamExt::buffered
or likeparallel-stream
- standback - backport APIs from newer Rust versions to older
- partial_borrow - tricky crate for partial borrows. May not mix well with
take_mut
/replace_with
. May be unsound. - https://github.com/QuarticCat/enum-ptr - Safe tagged pointers - utilise lower bits of aligned pointers to point to different things
- https://github.com/TimonPost/cargo-unused-features - tries to find unused Cargo features of your dependencies, using trial compilations. False positives possible.
- abscissa - framework to bind config parsing, error reporting, CLI apps and microservices together
- higher-order-closure - Allow function lifetime elision and explicit
for<'a>
annotations on closures - https://docs.rs/generativity/latest/generativity/ -
make_guard!(a);
- Create a trusted carrier with a new lifetime that is guaranteed to be unique among other trusted carriers. For various custom cell type tricks. - rkyv - zero-copy serialisation and deserialisation using relative pointers
- aliasable - Aliasable (non-
noalias
) Box, Vec, String.AliasableBox
,UniqueBox
. LikeBox
, but without some compiler magic. - custom-try - replace occurences of
?
withr#try!
. - https://docs.rs/detour/ - hot patching non-Rust ABI functions by overriding executable code
- alloctrack, dhat - tracking allocations by collecting stack traces from custom allocator
derive_adhoc
- proc marco to makemarco_rules!
-like derive macrossync_wrapper
-SyncWrapper
- sacrifice shared references to gainSync
for othewise un-Sync
things. Also tools to Sync-ify Futures and Streams.- https://crates.io/crates/triomphe - Arc with more features. Also
rclite
. - https://github.com/ericseppanen/cargo-cranky - workspace-wide lint configuration (allow, deny, warn, forbid).
jumprope
,crop
- rope / skiplist data structure for big texts- subenum - derive new subset enum from existing one by specifing which variants to keep
- kani - testing harness to exhaustively check functins. Like quickcheck/proptest, but without randomess, with some complicated things ("model checking") instead. Can deal even with
unsafe
? Only for small problems though - no parser checking. readonly
- proc macro hack to make struct fields only read-only accessible outside of the module. UsesDeref
and unsafe tricks.propane
- wrapper over unstable generator feature, implemented as a macro.effing-mad
- Something about "effect system" or generators. Don't understand it enough to descibe it here.errgo
- generate error variants from emitting points in function code using attribute macro.stack-map
- non-allocatingOrd
-based map with static array storage with fixed number of slots, based on bianry search.scoped-trace
- Build tree of function calls by sprinking the code withTrace::leaf()
and wrapping the main function inTrace::root
.pasts
- Simple executor forFuture
s that can be reentrered. Also someLoop
event loop where you control the storage for tasks.async-main
- Runtime-agnosticasync fn main
proc macro. Supports async-executor, sync-std, futures, pasts, tokio executors.onlyerror
- lightweightthiserror
.bbqueue
- BipBuffer queue, no_std friendly producer-consumer byte or byte frame queue of a fixed size.- https://github.com/panamax-rs/panamax Local rustup.rs and crates.io mirror
- https://github.com/untitaker/script-macro - Rhai-based scripted proc macro
- gag - temporarily redirect stdout/stderr.
const-chunks
v0.2: iterator adapter to chunk into const-length arraysallocator-api2
- switchuse alloc::
between build-in unstable and copied stable versions- criterion, divan - benchmarking
- strobe - fast, low-memory, elementwise array expressions on the stack. For performance. (I don't understand it so far).
- https://lib.rs/crates/cargo-show-asm
- cargo-msrv, a cargo subcommand to find out the Minimum Supported Rust Version (MSRV) of your crate
- streamcatcher - allow seeking on otherwise one-way streams. Thread-safe, shared (asynchronous) stream buffer designed to lock only on accessing and storing new data.
- once_map - OnceCell, but map. Append-only map, thread-safe, for caches.
- https://github.com/philipc/findpanics - analyse disassembly and debug info to find potentially panicking line locations
- https://github.com/SUPERCILEX/io-adapters -
fmt::Write
->io::Write
,io::Write
->hash::Hasher
- https://crates.io/crates/constcat -
std::concat! with support for const variables and expressions.
- https://crates.io/crates/trait-variant - official crate to help with async fn in traits
- macro_rules_attribute::apply - apply macro_rules!-based, i.e. function-call-style macro as if it were an attribute macro
- https://crates.io/crates/enum-iterator - iterate over enum variants
- venndb - in-memory database with proc-macro schema, append-only, for querying on ids and filtering on bool fields
- https://crates.io/crates/typeid - Const TypeId and non-'static TypeId.
- https://github.com/dtolnay/cargo-llvm-lines - check what monomorphisations bloat the executable up
- jiff - modern time with timezone library, competes with Chrono
- https://crates.io/crates/static-keys - configure bool choices by runtime patching the code
- iex - proc macro to convert
Result
-returning function to unwinding ones for performance reasons - https://crates.io/crates/crossmist - fork process and seamlessly communicate with it using SPSC channel, for Unix and Windows.
Various types of Arc/Rc with or without weak counter: https://internals.rust-lang.org/t/add-a-smart-pointer-with-only-strong-references-count/17635/7
"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)."
https://github.com/rosetta-rs/parse-rosetta-rs - comparison (and list) of various parsers
https://blessed.rs/crates - another list of crates
https://github.com/BurntSushi/rsc-regexp - three rewrites of a pointer-heavy and tricky C program into Rust, for educational purposes