module-concept

Rust Glob imports

Bring accessible names from a path into scope. A glob can be convenient in a small test module, but explicit imports often make production code easier to review. Glob imports may introduce ambiguous names. Expected result (not executed): 150 Why: Both accessible constants enter the local scope. Common mistake: Believing a glob makes private items accessible.

Formal Syntax & Structure

rust syntaxrust
use path::*;

Working Example

Example Snippetrust
mod units { pub const METER: u32 = 100; pub const HALF: u32 = 50; }use units::*;fn main() { println!("{}", METER + HALF); }
Rust Reference