[−][src]Trait mdl::model::Model
Trait to implement Cacheable data Model
Required methods
Loading content...Provided methods
fn db() -> &'static str
database name, where to store instances of this struct
fn tob(&self) -> Result<Vec<u8>, Error>
Data Struct serialization
fn fromb(data: &[u8]) -> Result<Self, Error>
Data Struct deserialization
fn store<S: Store>(&self, store: &S) -> Result<(), Error>
Persist the struct in the database
fn store_sig<S: Store, G: Signaler>(
&self,
store: &S,
sig: &G
) -> Result<(), Error>
&self,
store: &S,
sig: &G
) -> Result<(), Error>
Persist the struct in the database and emit the signal to the signaler
fn delete<S: Store>(&self, store: &S) -> Result<(), Error>
Deletes the object from the database
fn delete_sig<S: Store, G: Signaler>(
&self,
store: &S,
sig: &G
) -> Result<(), Error>
&self,
store: &S,
sig: &G
) -> Result<(), Error>
Deletes the object from the database and emit the signal to the signaler
fn get<S: Store>(store: &S, key: &str) -> Result<Self, Error>
Loads the struct from the database
fn all<S: Store>(store: &S, prefix: &str) -> Result<Vec<Self>, Error>
Get all objects with this prefix
fn iter<S, F>(store: &S, prefix: &str, f: F) -> Result<(), Error> where
S: Store,
F: Fn(Self) -> Continue,
S: Store,
F: Fn(Self) -> Continue,
Iterate over all objects with this prefix