Crate List - Blessed.rs
source link: https://blessed.rs/crates
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
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 |
---|---|
Random numbers |
rand |
UUIDs |
uuid |
Serialization (JSON, YAML, etc) |
serde |
Regular Expressions |
regex
fancy_regex |
Temporary files |
tempfile |
Gzip (de)compression |
flate2 |
Time & Date |
time
chrono |
Insertion-ordered map |
indexmap |
Stack-allocated arrays |
arrayvec
smallvec
tinyvec |
HTTP Requests |
reqwest
ureq |
Error Handling
Crates for more easily handling errors
Use Case | Recommended Crates |
---|---|
For applications |
anyhow |
For libraries |
thiserror |
Logging
Crates for logging. Note that in general you will need a seperate crate for actually printing/storing the logs
Use Case | Recommended Crates |
---|---|
Text-based logging |
tracing
log |
Structured logging |
tracing
slog |
Language Extensions
General purpose utility crates that extend language and/or stdlib functionality.
Use Case | Recommended Crates |
---|---|
Lazy static variable initialization |
once_cell
lazy_static |
Iterator helpers |
itertools |
Abstracting over different number types |
num |
Endian conversion |
byteorder |
Bitflags |
bitflags |
System
For low-level interaction with the underling platform / operating system
Use Case | Recommended Crates |
---|---|
Memory mapping files |
memmap2 |
Libc |
libc |
Windows (OS) |
windows
winapi |
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 |
---|---|
General purpose |
tokio
async-std |
io_uring |
glommio |
To do async programming using the async-await in Rust you need a runtime to execute drive your Futures.
Use Case | Recommended Crates |
---|---|
Types & Interfaces |
http |
Low-level HTTP Implementation |
hyper |
TLS / SSL |
rustls
rust-native-tls |
HTTP Client |
reqwest
surf
ureq |
HTTP Server |
axum
tide
actix-web
poem
warp
rocket |
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 |
---|---|
Low-level |
tungstenite-rs |
General Purpose |
tokio-tungstenite
async-tungstenite |
Use Case | Recommended Crates |
---|---|
General Purpose |
tonic |
Argument Parsing
See argparse-benchmarks-rs for a full comparison of the crates mentioned here and more.
Use Case | Recommended Crates |
---|---|
Fully-featured |
clap |
Minimal |
lexopt
pico-args |
Utility
Helpers that are often useful when implementing CLIs
Use Case | Recommended Crates |
---|---|
Globbing |
globset |
Directory walking |
walkdir
ignore |
File watching |
watchexec |
Terminal Rendering
For fancy terminal rendering and TUIs. The crates recommended here work cross-platform (including windows).
Use Case | Recommended Crates |
---|---|
Coloured Output |
termcolor |
Full TUI library |
crossterm |
Concurrency
Data Structures
Use Case | Recommended Crates |
---|---|
Mutex |
parking_lot |
Atomic pointer swapping |
arc_swap |
Concurrent HashMap |
See conc-map-bench for comparative benchmarks of concurrent HashMaps.
dashmap
flurry |
Channels |
See communicating-between-sync-and-async-code for notes on when to use async-specific channels vs general purpose channels.
crossbeam_channel
flume
postage |
Parallel computation |
rayon |
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK