Loader

Trait Loader 

Source
pub trait Loader<T>: Process{
    // Required method
    fn take(self) -> T;

    // Provided methods
    fn load_from_str<R: Read>(
        &mut self,
        input: R,
        format: Format,
    ) -> Result<(), Vec<String>> { ... }
    fn load_from_file(
        &mut self,
        path: &Path,
        format: Format,
    ) -> Result<(), Vec<String>> { ... }
    fn load_from_dir(&mut self, path: &Path) -> Result<(), Vec<String>> { ... }
}
Expand description

Loader represents the public part of the loading interface. Includes methods for loading from a file or folder, and accessing the final deserialized T value via the take method.

Required Methods§

Source

fn take(self) -> T

Consumes Self, and returns the final, deserialized T.

Provided Methods§

Source

fn load_from_str<R: Read>( &mut self, input: R, format: Format, ) -> Result<(), Vec<String>>

Source

fn load_from_file( &mut self, path: &Path, format: Format, ) -> Result<(), Vec<String>>

Deserializes a file with the provided format, and makes the result available via take. Returns a vector of non-fatal warnings on success, or a vector of error strings on failure.

Source

fn load_from_dir(&mut self, path: &Path) -> Result<(), Vec<String>>

Deserializes a dir with the provided format, and makes the result available via take. Returns a vector of non-fatal warnings on success, or a vector of error strings on failure.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§