How to choose the right package?


When I am searching for a specific functionality e.g. a regexpression library, how do I decide which of the existing packages fits my needs the best way?

Honestly I would rather prefer default packages like in java or python. Is there any chance that rust gets a bigger default library?


Rust libraries are normally published on (the Rust version of NPM or PyPI). Usually you'll use its search bar to look for the library you want (e.g. searching for regex crates). From there I'd look at the top couple results, then click the documentation link to browse the library's API and examples online.

The Rust standard library takes a different approach to Python and Java. Instead of including everything you could possibly need in the standard library, Rust has the bare minimum and prefers to let the ecosystem develop things. That way we're able to try out different alternatives without locking the Rust project into less-than-ideal APIs due to backwards compatibility (the Python standard library is often referred to as the place where modules go to die).

That said, this approach isn't perfect. It has discoverability issues, the ecosystem risks being fractured because there may be multiple incompatible crates which do the same job, and you don't necessarily have the stability or quality guarantees that a batteries-included standard library has.

tl;dr: is a place you can find loads of top quality crates, plus there's a search bar which will show download counts.

Some crates which are widely accepted as the library for their area:

  • regex - regular expressions
  • serde - serialization and deserialization
  • rand - random numbers
  • log - logging
  • clap - command-line argument parsing
  • structopt - command-line argument parsing (built on top of clap)
  • reqwest - HTTP client
  • rayon - super powerful parallelism library
  • bindgen - Automatically generates Rust FFI bindings to C and C++ libraries (for cross-language interop)


And you can visit for suggestions.

1 Like is also a good resource for finding suitable crates and tools.