Trait rhai::module_resolvers::ModuleResolver[][src]

pub trait ModuleResolver: SendSync {
    fn resolve(
        &self,
        engine: &Engine,
        source_path: Option<&str>,
        path: &str,
        pos: Position
    ) -> Result<Shared<Module>, Box<EvalAltResult>>; fn resolve_ast(
        &self,
        engine: &Engine,
        source_path: Option<&str>,
        path: &str,
        pos: Position
    ) -> Option<Result<AST, Box<EvalAltResult>>> { ... } }
Expand description

Trait that encapsulates a module resolution service.

Required methods

fn resolve(
    &self,
    engine: &Engine,
    source_path: Option<&str>,
    path: &str,
    pos: Position
) -> Result<Shared<Module>, Box<EvalAltResult>>
[src]

Resolve a module based on a path string.

Provided methods

fn resolve_ast(
    &self,
    engine: &Engine,
    source_path: Option<&str>,
    path: &str,
    pos: Position
) -> Option<Result<AST, Box<EvalAltResult>>>
[src]

Resolve an AST based on a path string.

Returns None (default) if such resolution is not supported (e.g. if the module is Rust-based).

Low-Level API

Override the default implementation of this method if the module resolver serves modules based on compiled Rhai scripts.

Implementors

impl ModuleResolver for DummyModuleResolver[src]

fn resolve(
    &self,
    _: &Engine,
    _: Option<&str>,
    path: &str,
    pos: Position
) -> Result<Shared<Module>, Box<EvalAltResult>>
[src]

impl ModuleResolver for FileModuleResolver[src]

fn resolve_ast(
    &self,
    engine: &Engine,
    source_path: Option<&str>,
    path: &str,
    pos: Position
) -> Option<Result<AST, Box<EvalAltResult>>>
[src]

Resolve an AST based on a path string.

The file system is accessed during each call; the internal cache is by-passed.

fn resolve(
    &self,
    engine: &Engine,
    source_path: Option<&str>,
    path: &str,
    pos: Position
) -> Result<Shared<Module>, Box<EvalAltResult>>
[src]

impl ModuleResolver for ModuleResolversCollection[src]

fn resolve(
    &self,
    engine: &Engine,
    source_path: Option<&str>,
    path: &str,
    pos: Position
) -> Result<Shared<Module>, Box<EvalAltResult>>
[src]

impl ModuleResolver for StaticModuleResolver[src]

fn resolve(
    &self,
    _: &Engine,
    _: Option<&str>,
    path: &str,
    pos: Position
) -> Result<Shared<Module>, Box<EvalAltResult>>
[src]