Trait DirStructureItem

Source
pub trait DirStructureItem: ReadFrom + WriteTo {
    // Provided methods
    fn read(path: impl AsRef<Path>) -> Result<Self>
       where Self: Sized { ... }
    fn write(&self, path: impl AsRef<Path>) -> Result<()> { ... }
}
Expand description

Helper trait, implemented for all types that have a ReadFrom and WriteTo implementation.

Provided Methods§

Source

fn read(path: impl AsRef<Path>) -> Result<Self>
where Self: Sized,

Uses the ReadFrom implementation to read the structure from disk, from the specified path.

Source

fn write(&self, path: impl AsRef<Path>) -> Result<()>

Uses the WriteTo implementation to write the structure to disk at the specified path.

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§

Source§

impl<T> DirStructureItem for T
where T: ReadFrom + WriteTo,