3 ms·
Rust has two distinct semantics surrounding how items can be "in scope". First, the `mod` keyword takes a module that the current file/scope can see and makes
by bobbylarrybobby 4y ago
Rust has two distinct semantics surrounding how items can be "in scope".
First, the `mod` keyword takes a module that the current file/scope can see and makes it available within that file/scope as if it had been defined there. This is necessary to make the module's items accessible, i.e., specifiable by their path within the module, in the current file/scope.
Then the `use` keyword takes an already-accessible member of a named scope -- a module, a type, etc -- and makes it usable by name (i.e., without scoping on each use) in the current scope.