module-concept
Rust Grouped imports
Group related imports that share a path prefix. This shortens repeated prefixes without changing the imported types or loading any additional dependency. Expected result (not executed): 2 2 Why: The two local names refer to standard-library types. Common mistake: Thinking use installs a package.
Formal Syntax & Structure
rust syntaxrust
use std::collections::{BTreeMap, BTreeSet};Working Example
Example Snippetrust
use std::collections::{BTreeMap, BTreeSet};fn main() { let prices = BTreeMap::from([("pen", 2)]); let tags = BTreeSet::from(["office", "sale"]); println!("{} {}", prices["pen"], tags.len());}