pub trait ModuleResolver {
    fn resolve(
        &self,
        global: GlobalEnvRef,
        path: &[String],
        import_file_path: Option<&str>
    ) -> Result<SymbolTable, ModuleLoadError<'_>>; }
Expand description

This trait is responsible for loading modules and returning a collection of name->value mappings for a module name.

See also GlobalEnv::set_resolver() about how to configure the global environment to use you trait implementation.

There is a default implementation named LocalFileModuleResolver, which loads the modules from files.

Required methods

Resolves the path to a HashMap of names -> VVal. Where you obtain this mapping from is completely up to you. You can statically define these, load them from a JSON file, load them by executing another WLambda script or whatever you fancy.

See LocalFileModuleResolver as example on how to implement this.

Implementors