Libraries
C++ programs tend to either use libraries that come with operating system distributions or that are vendored.
Rust programs tend to rely on a central registry of Rust libraries ("crates") called crates.io (along with a central documentation repository created from the in-code documentation of those crates called docs.rs). Dependencies on crates are managed using the Cargo package manager.
Lib.rs is a good resource for finding popular crates organized by category.
Some specific alternatives
C++ library | Rust alternative |
---|---|
STL UTF-16 and UTF-32 strings | widestring |
STL random | rand |
STL regex | regex |
Boost.Test | cargo test |
pybind11 | PyO3 |
OpenSSL | rustls |
If there is a C++ library that you use where you cannot find a Rust alternative, please leave feedback using the link below, letting us know the name and purpose of the library.
Supply chain management
In situations where managing the library supply chain is important, Cargo can be used either with custom self-managed or organization-managed registries or with vendored versions of dependencies fetched from crates.io.
Both approaches provide mechanisms for reviewing dependencies as part supply chain security.
Solutions for supply chain security that do not involve vendoring or custom registries are in progress.
Click here to leave us feedback about this page.