Trait gds::SerdeFile

source ·
pub trait SerdeFile: Serialize + DeserializeOwned {
    // Provided methods
    fn save(
        &self,
        fmt: SerializationFormat,
        fname: impl AsRef<Path>
    ) -> Result<(), Error> { ... }
    fn open(
        fname: impl AsRef<Path>,
        fmt: SerializationFormat
    ) -> Result<Self, Error> { ... }
}
Expand description

A trait for serializing/deserializing files.

Includes:

  • open for loading from file
  • save for saving to file

Fully default-implemented, allowing empty implementations for types that implement serde serialization and deserialization.

Provided Methods§

source

fn save( &self, fmt: SerializationFormat, fname: impl AsRef<Path> ) -> Result<(), Error>

Saves in fmt-format to file fname.

source

fn open( fname: impl AsRef<Path>, fmt: SerializationFormat ) -> Result<Self, Error>

Opens from fmt-format file fname.

Object Safety§

This trait is not object safe.

Implementors§