pub struct ModuleIndex { /* private fields */ }Expand description
Groups declarations by their namespace prefix.
The namespace is the dot-separated prefix of a name: the namespace of
"Nat.add" is "Nat", and top-level names (no dot) live in the ""
(empty) namespace.
Implementations§
Source§impl ModuleIndex
impl ModuleIndex
Sourcepub fn add(&mut self, name: &str, id: u32)
pub fn add(&mut self, name: &str, id: u32)
Record that declaration id belongs to the namespace of name.
The namespace is derived from name via namespace_of.
Sourcepub fn lookup_namespace(&self, prefix: &str) -> Vec<u32>
pub fn lookup_namespace(&self, prefix: &str) -> Vec<u32>
Return all declaration ids that belong to namespace prefix.
Returns an empty Vec if no declarations with that prefix exist.
Sourcepub fn all_namespaces(&self) -> Vec<String>
pub fn all_namespaces(&self) -> Vec<String>
Return all namespace prefixes that have at least one declaration.
Trait Implementations§
Source§impl Clone for ModuleIndex
impl Clone for ModuleIndex
Source§fn clone(&self) -> ModuleIndex
fn clone(&self) -> ModuleIndex
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ModuleIndex
impl Debug for ModuleIndex
Auto Trait Implementations§
impl Freeze for ModuleIndex
impl RefUnwindSafe for ModuleIndex
impl Send for ModuleIndex
impl Sync for ModuleIndex
impl Unpin for ModuleIndex
impl UnsafeUnpin for ModuleIndex
impl UnwindSafe for ModuleIndex
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