Specify the dependencies in Cargo.toml like so:
[dependencies]
rand = { version = "0.7.2", features = ["small_rng"] }
Alternatively:
[dependencies.rand]
version = "0.7.2"
features = ["small_rng"]
Both work.
More Related Contents:
- Package with both a library and a binary?
- Why are Rust executables so huge?
- How do I ‘pass down’ feature flags to subdependencies in Cargo?
- How do I use conditional compilation with `cfg` and Cargo?
- What is a crate attribute and where do I add it?
- How can a Rust program access metadata from its Cargo package?
- How do I specify the linker path in Rust?
- Can Cargo download and build dependencies without also building the application?
- Is there a list of all cfg features?
- How to idiomatically alias a crate in Rust 2018?
- How to tell what “features” are available per crate?
- How can I build multiple binaries with Cargo?
- How to pass rustc flags to cargo?
- How do I pin indirect dependencies of a crate?
- How do I create a global, mutable singleton?
- Cannot move out of value which is behind a shared reference when unwrapping
- When does a closure implement Fn, FnMut and FnOnce?
- How to test for equality between trait objects?
- error [E0716]: temporary value dropped while borrowed (rust)
- Can I get a trait object of a multi-trait instance without using a generic type?
- Trait implementation for both a trait object and for direct implementors of the trait
- Why does my variable not live long enough?
- How to iterate over and filter an array?
- If BufReader takes ownership of a stream, how can I read and write lines on it?
- How to fix lifetime error when function returns a serde Deserialize type?
- Efficiently insert or replace multiple elements in the middle or at the beginning of a Vec?
- Calling a generic async function with a (mutably) borrowed argument
- What makes `impl Trait` as an argument “universal” and as a return value “existential”?
- Do all primitive types implement the Copy trait?
- Mutable reference to container object within iterator loop