pub struct ModuleRegistry { /* private fields */ }Expand description
A registry that tracks which declarations come from which module.
Used during compilation to produce better error messages and to support incremental builds.
Implementations§
Source§impl ModuleRegistry
impl ModuleRegistry
Sourcepub fn register(&mut self, decl_name: Name, module_name: String)
pub fn register(&mut self, decl_name: Name, module_name: String)
Register a declaration as coming from a module.
Sourcepub fn register_module(&mut self, module: &ExportedModule)
pub fn register_module(&mut self, module: &ExportedModule)
Register all declarations from a module.
Sourcepub fn module_for(&self, decl: &Name) -> Option<&str>
pub fn module_for(&self, decl: &Name) -> Option<&str>
Look up which module a declaration came from.
Sourcepub fn decls_for_module(&self, module: &str) -> &[Name]
pub fn decls_for_module(&self, module: &str) -> &[Name]
Get all declarations provided by a module.
Sourcepub fn all_module_names(&self) -> Vec<&str>
pub fn all_module_names(&self) -> Vec<&str>
Get all registered module names.
Sourcepub fn contains_decl(&self, decl: &Name) -> bool
pub fn contains_decl(&self, decl: &Name) -> bool
Check if a declaration is registered.
Sourcepub fn num_modules(&self) -> usize
pub fn num_modules(&self) -> usize
Number of registered modules.
Trait Implementations§
Source§impl Debug for ModuleRegistry
impl Debug for ModuleRegistry
Source§impl Default for ModuleRegistry
impl Default for ModuleRegistry
Source§fn default() -> ModuleRegistry
fn default() -> ModuleRegistry
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ModuleRegistry
impl RefUnwindSafe for ModuleRegistry
impl Send for ModuleRegistry
impl Sync for ModuleRegistry
impl Unpin for ModuleRegistry
impl UnsafeUnpin for ModuleRegistry
impl UnwindSafe for ModuleRegistry
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