Skip to main content

PersistenceService

Trait PersistenceService 

Source
pub trait PersistenceService: Send + Sync {
    // Required methods
    fn load(&self) -> Result<Option<PersistedState>, String>;
    fn save(&self, state: &PersistedState) -> Result<(), String>;
    fn reset(&self) -> Result<(), String>;
}
Expand description

Save/load TUI state to disk.

Required Methods§

Source

fn load(&self) -> Result<Option<PersistedState>, String>

Load persisted state.

Source

fn save(&self, state: &PersistedState) -> Result<(), String>

Save current state.

Source

fn reset(&self) -> Result<(), String>

Delete persisted state (reset).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§