Skip to main content

Loader

Trait Loader 

Source
pub trait Loader {
    // Required method
    fn load(&self, path: &Path) -> Result<String, LoadError>;
}
Expand description

A pluggable source-text loader.

Implementations decide where bytes come from (filesystem, in-memory map, virtual filesystem, content-addressed store, …). lex-core never references std::fs directly through this trait; that keeps the resolver pure and usable in WASM, sandboxes, and unit tests.

Required Methods§

Source

fn load(&self, path: &Path) -> Result<String, LoadError>

Load the source text for path. The path is the canonical absolute path the resolver decided on after applying the rules in §4 of the proposal.

Implementors§