pub trait Storage {
    // Required methods
    fn db_path(&self) -> PathBuf;
    fn open_db(&self) -> Result<Db, Error>;
    fn get<T>(&self, key: &str) -> Result<Option<T>, Error>
       where T: for<'a> Deserialize<'a>;
    fn set<T>(&self, key: &str, value: &T) -> Result<(), Error>
       where T: Serialize;
    fn delete(&self, key: &str) -> Result<(), Error>;
    fn clear(&self) -> Result<(), Error>;
    fn load_from_json<T>(&self, key: &str, path: PathBuf) -> Result<(), Error>
       where T: for<'a> Deserialize<'a> + Serialize;
    fn iter_keys(&self) -> Result<Vec<String>, Error>;
}

Required Methods§

source

fn db_path(&self) -> PathBuf

source

fn open_db(&self) -> Result<Db, Error>

source

fn get<T>(&self, key: &str) -> Result<Option<T>, Error>
where T: for<'a> Deserialize<'a>,

source

fn set<T>(&self, key: &str, value: &T) -> Result<(), Error>
where T: Serialize,

source

fn delete(&self, key: &str) -> Result<(), Error>

source

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

source

fn load_from_json<T>(&self, key: &str, path: PathBuf) -> Result<(), Error>
where T: for<'a> Deserialize<'a> + Serialize,

source

fn iter_keys(&self) -> Result<Vec<String>, Error>

Object Safety§

This trait is not object safe.

Implementors§