pub trait Collection<'a, T>where
T: Serialize + DeserializeOwned + 'a,{
// Required methods
fn put(&mut self, key: &str, value: T) -> Result<Option<T>, Error>;
fn get(&mut self, key: &str) -> Result<Option<T>, Error>;
fn prefix(
&mut self,
prefix: &str,
) -> Box<dyn Iterator<Item = Result<T, Error>> + 'a>;
}Expand description
A Collection contains serializable objects which are accessible by a key.
Required Methods§
Sourcefn put(&mut self, key: &str, value: T) -> Result<Option<T>, Error>
fn put(&mut self, key: &str, value: T) -> Result<Option<T>, Error>
Put the given value into the collection under the given key. If the key already exists, it’s replaced with the given value and the old value is returned.