Trait ajour_core::fs::PersistentData[][src]

pub trait PersistentData: DeserializeOwned + Serialize {
    fn relative_path() -> PathBuf;

    fn path() -> Result<PathBuf, FilesystemError> { ... }
fn load() -> Result<Self, FilesystemError> { ... }
fn load_or_default<T: PersistentData + Default>(
    ) -> Result<T, FilesystemError> { ... }
fn save(&self) -> Result<(), FilesystemError> { ... } }

Defines a serializable struct that should persist on the filesystem inside the Ajour config directory.

Required methods

fn relative_path() -> PathBuf[src]

Only method required to implement PersistentData on an object. Always relative to the config folder for Ajour.

Loading content...

Provided methods

fn path() -> Result<PathBuf, FilesystemError>[src]

Returns the full file path. Will create any parent directories that don’t exist.

fn load() -> Result<Self, FilesystemError>[src]

Load from PersistentData::path().

fn load_or_default<T: PersistentData + Default>() -> Result<T, FilesystemError>[src]

Load from PersistentData::path(). If file doesn’t exist, save it to the filesystem as Default and return that object.

fn save(&self) -> Result<(), FilesystemError>[src]

Save to PersistentData::path()

Loading content...

Implementors

Loading content...