vedvaring

Trait SingletonPersist

Source
pub trait SingletonPersist:
    for<'a> Deserialize<'a>
    + Serialize
    + Default {
    // Required methods
    fn name() -> String;
    fn dir_name() -> String;

    // Provided methods
    fn save(&self) { ... }
    fn delete(self) { ... }
    fn open() { ... }
    fn dir() -> PathBuf { ... }
    fn path() -> PathBuf { ... }
    fn load() -> Self { ... }
}
Expand description

For singleton stuff, like config files, they need to implement default so a new one is created at first load.

Required Methods§

Provided Methods§

Source

fn save(&self)

Source

fn delete(self)

Source

fn open()

Source

fn dir() -> PathBuf

Source

fn path() -> PathBuf

Source

fn load() -> Self

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§