Skip to main content

FileLoader

Trait FileLoader 

Source
pub trait FileLoader {
    // Required methods
    fn normalize(&self, path: &str, basepath: &str) -> String;
    fn load(&self, key: &str) -> ComposeResult<LoadedDoc>;
}
Expand description

Loads a normalized file key to its parsed document. load returns ComposeLoadError(REF_FILE_NOT_FOUND) when the key is absent — the engine relies on that exact code (an unresolved $ref is a load error, never valid:true).

Required Methods§

Source

fn normalize(&self, path: &str, basepath: &str) -> String

Resolve path against basepath to the canonical key the map uses.

Source

fn load(&self, key: &str) -> ComposeResult<LoadedDoc>

Load the parsed document at the canonical key, or return NOT_FOUND.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§