Expand description
This module provides the traits for loading modules from some source.
The goal of the traits ModuleResolver
and ModuleLoader
is to provide the ability to load
a module into memory from some resource.
§Example
use sdml_core::model::identifiers::Identifier;
use sdml_core::load::ModuleLoader;
use sdml_core::store::ModuleStore;
fn module_found(
module: &Identifier,
loader: &mut impl ModuleLoader,
cache: &mut impl ModuleStore
) -> bool {
loader.load(module, None, cache, false).is_ok()
}
Traits§
- A loader instance is responsible for resolving a module into a resource URL and parsing it into memory. Note that the loader does not return the module instance itself but rather the module’s name parsed from the resource, the module itself is inserted into the
cache
. - A resolver implementation is responsible for determining the resource identifier (URL) for a module named
name
. The additional parameterfrom
identifies the module source making the request.