pub struct ModuleRegistry {
pub roots: Vec<PathBuf>,
pub cache: HashMap<ModulePath, ModuleInfo>,
}Expand description
Registry that maps ModulePaths to ModuleInfos, with file-system
root search and a resolution cache.
Fields§
§roots: Vec<PathBuf>Root directories searched when resolving a module path to a file.
cache: HashMap<ModulePath, ModuleInfo>Cache: module path → resolved info. Populated on first successful
ModuleRegistry::resolve or explicit ModuleRegistry::register.
Implementations§
Source§impl ModuleRegistry
impl ModuleRegistry
Sourcepub fn resolve(&mut self, path: &ModulePath) -> ModuleResolutionResult
pub fn resolve(&mut self, path: &ModulePath) -> ModuleResolutionResult
Look up path in the cache; if absent, search the root directories for
a matching .lean or .oxilean file. Populates the cache on success.
Sourcepub fn register(&mut self, path: ModulePath, info: ModuleInfo)
pub fn register(&mut self, path: ModulePath, info: ModuleInfo)
Manually register a module (bypasses file-system search).
Trait Implementations§
Source§impl Clone for ModuleRegistry
impl Clone for ModuleRegistry
Source§fn clone(&self) -> ModuleRegistry
fn clone(&self) -> ModuleRegistry
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 moreAuto 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