[−][src]Trait sledis::list::ListWriteStore
This trait provides deque semantics for the lists in ListReadStore
.
Example Initialization
use sledis::{ListReadStore, ListWriteStore}; use sled::Config; let tree = Config::new().temporary(true).open().unwrap(); // A new empty list let list_meta_data = tree.list_get_meta(b"my_list").unwrap(); assert_eq!(list_meta_data.len(), 0); assert_eq!(tree.list_len(b"my_list").unwrap(), 0); // pushing and popping from the front tree.list_push_front(b"my_list", b"oof").unwrap(); assert_eq!(tree.list_len(b"my_list").unwrap(), 1); assert_eq!(tree.list_pop_front(b"my_list").unwrap().unwrap(), b"oof"); assert_eq!(tree.list_len(b"my_list").unwrap(), 0); // and the back tree.list_push_back(b"my_list", b"oof").unwrap(); assert_eq!(tree.list_len(b"my_list").unwrap(), 1); assert_eq!(tree.list_pop_back(b"my_list").unwrap().unwrap(), b"oof"); assert_eq!(tree.list_len(b"my_list").unwrap(), 0);
Required methods
fn list_push_front<V>(&self, name: &[u8], val: V) -> Result<(), Self::Error> where
IVec: From<V>,
IVec: From<V>,
fn list_push_back<V>(&self, name: &[u8], val: V) -> Result<(), Self::Error> where
IVec: From<V>,
IVec: From<V>,
fn list_pop_front(&self, name: &[u8]) -> Result<Option<IVec>, Self::Error>
fn list_pop_back(&self, name: &[u8]) -> Result<Option<IVec>, Self::Error>
fn list_set<V>(
&self,
name: &[u8],
ix: u64,
val: V
) -> Result<Option<IVec>, Self::Error> where
IVec: From<V>,
&self,
name: &[u8],
ix: u64,
val: V
) -> Result<Option<IVec>, Self::Error> where
IVec: From<V>,
Implementors
impl<S> ListWriteStore for S where
S: WriteStore + ListReadStore,
S::Error: From<Error>,
[src]
S: WriteStore + ListReadStore,
S::Error: From<Error>,
fn list_push_front<V>(&self, name: &[u8], val: V) -> Result<(), Self::Error> where
IVec: From<V>,
[src]
IVec: From<V>,
fn list_push_back<V>(&self, name: &[u8], val: V) -> Result<(), Self::Error> where
IVec: From<V>,
[src]
IVec: From<V>,
fn list_pop_front(&self, name: &[u8]) -> Result<Option<IVec>, Self::Error>
[src]
fn list_pop_back(&self, name: &[u8]) -> Result<Option<IVec>, Self::Error>
[src]
fn list_set<V>(
&self,
name: &[u8],
ix: u64,
val: V
) -> Result<Option<IVec>, Self::Error> where
IVec: From<V>,
[src]
&self,
name: &[u8],
ix: u64,
val: V
) -> Result<Option<IVec>, Self::Error> where
IVec: From<V>,