Storable

Trait Storable 

Source
pub trait Storable: Jsonable + StoragePath {
    // Provided methods
    fn load() -> Result<Self, Error> { ... }
    fn save(&self) -> Result<(), Error> { ... }
}
Expand description

Trait for types that can be stored in a file.

If implemented, the type can be loaded from and saved to a file. The file is located in the user’s home directory. It requieres the type to implement the Jsonable and StoragePath traits.

Provided Methods§

Source

fn load() -> Result<Self, Error>

Loads the type from the storage file.

Source

fn save(&self) -> Result<(), Error>

Saves the type to the storage file.

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§