Trait ketos::module::ModuleLoader
[−]
[src]
pub trait ModuleLoader {
fn load_module(&self, name: Name, ctx: Context) -> Result<Module, Error>;
fn chain<T: ModuleLoader>(self, second: T) -> ChainModuleLoader<Self, T> where Self: Sized { ... }
}
Provides a method for loading modules into a running interpreter.
Required Methods
fn load_module(&self, name: Name, ctx: Context) -> Result<Module, Error>
Loads the named module, supplying a new execution context.
If the loader cannot load the named module, an error value should be
returned of Err(Error::CompileError(CompileError::ModuleError(name)))
.
Provided Methods
fn chain<T: ModuleLoader>(self, second: T) -> ChainModuleLoader<Self, T> where Self: Sized
Creates a ChainModuleLoader
using this loader and another.
The ChainModuleLoader
will attempt to load a module first from self
,
falling back on the supplied ModuleLoader
if it unable to find a
module.
Implementors
impl ModuleLoader for NullModuleLoader
impl<A, B> ModuleLoader for ChainModuleLoader<A, B> where A: ModuleLoader,
B: ModuleLoaderimpl ModuleLoader for BuiltinModuleLoader
impl ModuleLoader for FileModuleLoader