Struct sdml_parse::load::ModuleLoader
source · pub struct ModuleLoader { /* private fields */ }Expand description
The loader is used to manage the process of creating an in-memory model from file-system resources.
A Module Loader is therefore responsible for:
- finding the resource that contains a module definition,
- parsing the source into an in-memory representation,
- caching the loaded module, and it’s source, for future use.
Implementations§
source§impl ModuleLoader
impl ModuleLoader
pub fn with_resolver(self, resolver: ModuleResolver) -> Self
sourcepub fn load(
&mut self,
name: &Identifier,
cache: &mut ModuleCache,
recursive: bool
) -> Result<Identifier, Error>
pub fn load( &mut self, name: &Identifier, cache: &mut ModuleCache, recursive: bool ) -> Result<Identifier, Error>
Load the named module using the loader’s current resolver.
sourcepub fn load_from_file(
&mut self,
file: PathBuf,
cache: &mut ModuleCache,
recursive: bool
) -> Result<Identifier, Error>
pub fn load_from_file( &mut self, file: PathBuf, cache: &mut ModuleCache, recursive: bool ) -> Result<Identifier, Error>
Load a module from the source in file.
sourcepub fn load_from_reader(
&mut self,
reader: &mut dyn Read,
cache: &mut ModuleCache,
recursive: bool
) -> Result<Identifier, Error>
pub fn load_from_reader( &mut self, reader: &mut dyn Read, cache: &mut ModuleCache, recursive: bool ) -> Result<Identifier, Error>
Load a module reading the source from reader.
pub fn get_source(&self, name: &Identifier) -> Option<Source>
pub fn resolver(&self) -> &ModuleResolver
Trait Implementations§
source§impl Clone for ModuleLoader
impl Clone for ModuleLoader
source§fn clone(&self) -> ModuleLoader
fn clone(&self) -> ModuleLoader
Returns a copy 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 ModuleLoader
impl Debug for ModuleLoader
Auto Trait Implementations§
impl RefUnwindSafe for ModuleLoader
impl Send for ModuleLoader
impl Sync for ModuleLoader
impl Unpin for ModuleLoader
impl UnwindSafe for ModuleLoader
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