Skip to main content

Loader

Trait Loader 

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

    // Provided method
    fn load_bytes(&mut self, path: &Path) -> Result<Vec<u8>, Error> { ... }
}
Expand description

Supplies included file text, so tests can run without a filesystem.

Required Methods§

Source

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

Provided Methods§

Source

fn load_bytes(&mut self, path: &Path) -> Result<Vec<u8>, Error>

Binary profile data. Text-only test loaders retain their existing API; filesystem/named-buffer acquisition overrides this without UTF-8 decoding.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl<F> Loader for F
where F: FnMut(&Path) -> Result<String, Error>,