pub struct ModuleRegistry { /* private fields */ }Expand description
Maintains the full module graph with circular-dependency detection.
Implementations§
Source§impl ModuleRegistry
impl ModuleRegistry
pub fn new(loader: Box<dyn ModuleLoader>) -> Self
pub fn with_string_map(map: HashMap<String, String>) -> Self
Sourcepub fn require(&mut self, path: &str, vm: &mut Vm) -> Result<Value, ScriptError>
pub fn require(&mut self, path: &str, vm: &mut Vm) -> Result<Value, ScriptError>
require(path, vm) — load, compile and execute a module; cache result.
Sourcepub fn reload(&mut self, path: &str, vm: &mut Vm) -> Result<Value, ScriptError>
pub fn reload(&mut self, path: &str, vm: &mut Vm) -> Result<Value, ScriptError>
Reload a module by path (re-compile and re-execute).
Sourcepub fn loaded_modules(&self) -> Vec<String>
pub fn loaded_modules(&self) -> Vec<String>
List all loaded module names.
pub fn get_module(&self, path: &str) -> Option<&Module>
Sourcepub fn dependency_tree(&self, path: &str) -> String
pub fn dependency_tree(&self, path: &str) -> String
ASCII-art dependency tree for a module.
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