Skip to main content

Format

Trait Format 

Source
pub trait Format<T> {
    type Error: Error + 'static;

    // Required method
    fn read(&mut self, path: &Path) -> Result<Module<T>, Self::Error>;
}
Available on crate feature file only.
Expand description

A file format.

This trait describes how to read and deserialize the contents of a file into a module.

Required Associated Types§

Source

type Error: Error + 'static

Error for Format::read.

Required Methods§

Source

fn read(&mut self, path: &Path) -> Result<Module<T>, Self::Error>

Read the file at path and deserialize the module in it.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl<T> Format<T> for Json
where T: for<'de> Deserialize<'de>,

Available on crate feature json only.
Source§

impl<T> Format<T> for Toml
where T: for<'de> Deserialize<'de>,

Available on crate feature toml only.