Skip to main content

Storage

Trait Storage 

Source
pub trait Storage: Send + Sync {
    // Required methods
    fn load(&self) -> Result<Config, Error>;
    fn save(&self, config: &Config) -> Result<(), Error>;
    fn init(&self) -> Result<(), Error>;
    fn backend_name(&self) -> &str;

    // Provided method
    fn path(&self) -> Option<&Path> { ... }
}
Expand description

Backend-agnostic storage for link data.

Operates on Config as a whole — fine-grained CRUD can be added as default methods later.

Required Methods§

Source

fn load(&self) -> Result<Config, Error>

Load the full config (urls, groups).

Source

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

Save the full config, replacing whatever was stored.

Source

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

Initialize storage if it doesn’t exist yet.

Source

fn backend_name(&self) -> &str

Human-readable backend name (“toml”, “database”, etc).

Provided Methods§

Source

fn path(&self) -> Option<&Path>

Path to the underlying storage (if file-based).

Implementors§