Skip to main content

Resolver

Trait Resolver 

Source
pub trait Resolver {
    // Required method
    fn load(&self, path: &str) -> Result<String, CompileError>;

    // Provided method
    fn resolve(&self, _base: &str, relative: &str) -> String { ... }
}
Expand description

Resolves IMPORT "path" to source text. The engine is source-agnostic: it consumes strings, so a file is merely one backing store. Mirrors vsm-grammar’s SourceResolver.

Required Methods§

Source

fn load(&self, path: &str) -> Result<String, CompileError>

Load the raw source text for a resolved path.

Provided Methods§

Source

fn resolve(&self, _base: &str, relative: &str) -> String

Normalize relative against the importing source base. Default: paths are absolute names, returned unchanged.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl Resolver for FileResolver

Available on crate feature std only.
Source§

impl Resolver for MemoryResolver