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§
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>
Object Safety§
This trait is not object safe.