SerDe

Trait SerDe 

Source
pub trait SerDe {
    // Required methods
    fn load<T>(&self) -> Result<T>
       where T: for<'de> Deserialize<'de>;
    fn save<T>(&self, value: &T) -> Result<()>
       where T: Serialize;
}
Expand description

Trait to wrap serialization and deserialization functionality behind uniform load and save functions

Required Methods§

Source

fn load<T>(&self) -> Result<T>
where T: for<'de> Deserialize<'de>,

Deserialize into a specified type

§Errors

In case the deserialization or the reading fails the return value will contain the first error that occurred.

Source

fn save<T>(&self, value: &T) -> Result<()>
where T: Serialize,

Serialize into the type of the last sink specified

§Errors

In case the serialization or the writing fails the return value will contain the first error that occurred.

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<B> SerDe for Builder<B>
where B: RwBuilder, B::Reader: Read, B::Writer: Write,