The use Statement and Path Resolution

Updated

October 31, 2026

The use Statement and Path Resolution

The use keyword brings paths into scope to avoid verbose qualification:

mod storage {
    pub mod cache {
        pub fn clear() {
            println!("Cache cleared.");
        }
    }
}

// Bring clear into scope
use storage::cache::clear;

fn main() {
    clear();
}