[−][src]Trait mdl::store::Store
Trait that defines a Store that can be implemented to save Model objects in memory, filesystem or the network
Required methods
fn push(&self, db: &'static str, key: &str, value: Vec<u8>) -> Result<(), Error>
Stores the value in the database with the corresponding key
fn pull<F, T>(
&self,
db: &'static str,
key: &str,
formatter: F
) -> Result<T, Error> where
F: Fn(&[u8]) -> Result<T, Error>,
&self,
db: &'static str,
key: &str,
formatter: F
) -> Result<T, Error> where
F: Fn(&[u8]) -> Result<T, Error>,
Retrieves the value in the database with the corresponding key Returns an error if the key doesn't exists
fn iter<F>(&self, db: &'static str, prefix: &str, f: F) -> Result<(), Error> where
F: Fn(&[u8]) -> Continue,
F: Fn(&[u8]) -> Continue,
Iterates over all objects that starts with the prefix and run the function f. If f returns Continue(false) the iteration stops
fn rm(&self, db: &'static str, key: &str) -> Result<(), Error>
Remove the corresponding data in the database by key
Provided methods
fn all<F, T>(
&self,
db: &'static str,
prefix: &str,
formatter: F
) -> Result<Vec<T>, Error> where
F: Fn(&[u8]) -> Result<T, Error>,
&self,
db: &'static str,
prefix: &str,
formatter: F
) -> Result<Vec<T>, Error> where
F: Fn(&[u8]) -> Result<T, Error>,
Retrieves all items in the database that starts with the prefix key
Implementors
impl Store for mdl::bcache::Cache
[src]
fn push(&self, db: &'static str, key: &str, value: Vec<u8>) -> Result<(), Error>
[src]
fn pull<F, T>(
&self,
db: &'static str,
key: &str,
formatter: F
) -> Result<T, Error> where
F: Fn(&[u8]) -> Result<T, Error>,
[src]
&self,
db: &'static str,
key: &str,
formatter: F
) -> Result<T, Error> where
F: Fn(&[u8]) -> Result<T, Error>,
fn iter<F>(&self, db: &'static str, prefix: &str, f: F) -> Result<(), Error> where
F: Fn(&[u8]) -> Continue,
[src]
F: Fn(&[u8]) -> Continue,
fn rm(&self, db: &'static str, key: &str) -> Result<(), Error>
[src]
impl Store for mdl::cache::Cache
[src]
fn push(&self, db: &'static str, key: &str, value: Vec<u8>) -> Result<(), Error>
[src]
fn pull<F, T>(
&self,
db: &'static str,
key: &str,
formatter: F
) -> Result<T, Error> where
F: Fn(&[u8]) -> Result<T, Error>,
[src]
&self,
db: &'static str,
key: &str,
formatter: F
) -> Result<T, Error> where
F: Fn(&[u8]) -> Result<T, Error>,
fn iter<F>(&self, db: &'static str, prefix: &str, f: F) -> Result<(), Error> where
F: Fn(&[u8]) -> Continue,
[src]
F: Fn(&[u8]) -> Continue,