Skip to main content

FileLoader

Trait FileLoader 

Source
pub trait FileLoader {
    // Required method
    fn load(&self, path: &str, from: Option<&str>) -> Option<(String, String)>;
}
Expand description

How the preprocessor finds an included file.

A trait rather than direct file access, so the whole preprocessor is testable without a filesystem and so a build system can supply its own include path.

Required Methods§

Source

fn load(&self, path: &str, from: Option<&str>) -> Option<(String, String)>

Resolve and read path, as requested from from.

Returns the resolved name and the contents. None if it cannot be found — the caller diagnoses that rather than the loader.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§