pub enum Namespace {
Value,
Type,
Module,
Macro,
Label,
}Expand description
One of the language-level namespaces a name can live in.
HIR paths carry a syntactic namespace (hir_lang::Ns); these are the
tables names are stored in. A language merges tables with
Policy::with_merge (Python keeps everything in one table; Rust keeps types
and modules in one).
§Examples
use resolve_lang::Namespace;
assert_eq!(Namespace::Value.name(), "value");
assert_eq!(Namespace::ALL.len(), 5);Variants§
Value
Functions, constants, globals, constructors.
Type
Records, sums, classes, interfaces, aliases.
Module
Modules and units.
Macro
Macros. HIR has no macro items (macros expand before lowering); hosts
may still export names here through Env.
Label
Loop and block labels. Labels are binders resolved by lowering, so no HIR path is looked up here; the namespace exists for merging rules.
Implementations§
Trait Implementations§
impl Copy for Namespace
impl Eq for Namespace
Source§impl Ord for Namespace
impl Ord for Namespace
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for Namespace
impl PartialOrd for Namespace
impl StructuralPartialEq for Namespace
Auto Trait Implementations§
impl Freeze for Namespace
impl RefUnwindSafe for Namespace
impl Send for Namespace
impl Sync for Namespace
impl Unpin for Namespace
impl UnsafeUnpin for Namespace
impl UnwindSafe for Namespace
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more