keyword
Rust use: bring a path into scope
A use declaration introduces a name into scope so you can refer to an item without writing its full path each time. It does not install a dependency. Expected output (not executed): 3 Why: The imported name resolves to the standard-library map type. Common mistake: Adding use does not download an external crate; Cargo dependencies are configured separately.
Formal Syntax & Structure
rust syntaxrust
use path::Item;Working Example
Example Snippetrust
use std::collections::BTreeMap;
fn main() { let mut prices = BTreeMap::new(); prices.insert("tea", 3); println!("{}", prices["tea"]);}