pub struct ModuleCache { /* private fields */ }Expand description
Module cache for managing multiple modules.
Implementations§
Source§impl ModuleCache
impl ModuleCache
Sourcepub fn add(&mut self, module: ExportedModule)
pub fn add(&mut self, module: ExportedModule)
Add a module to the cache.
Sourcepub fn get(&self, name: &str) -> Option<&ExportedModule>
pub fn get(&self, name: &str) -> Option<&ExportedModule>
Get a module from the cache.
Sourcepub fn all_modules(&self) -> Vec<&str>
pub fn all_modules(&self) -> Vec<&str>
Get all cached module names.
Sourcepub fn num_modules(&self) -> usize
pub fn num_modules(&self) -> usize
Get the number of cached modules.
Sourcepub fn import_all(&self, env: &mut Environment) -> Result<(), String>
pub fn import_all(&self, env: &mut Environment) -> Result<(), String>
Import all cached modules into an environment (in order).
Sourcepub fn import_with_deps(
&self,
env: &mut Environment,
name: &str,
) -> Result<(), String>
pub fn import_with_deps( &self, env: &mut Environment, name: &str, ) -> Result<(), String>
Import a specific module and its transitive dependencies.
Sourcepub fn remove(&mut self, name: &str) -> Option<ExportedModule>
pub fn remove(&mut self, name: &str) -> Option<ExportedModule>
Remove a module from the cache.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ModuleCache
impl RefUnwindSafe for ModuleCache
impl Send for ModuleCache
impl Sync for ModuleCache
impl Unpin for ModuleCache
impl UnsafeUnpin for ModuleCache
impl UnwindSafe for ModuleCache
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