pub struct List<T> { /* private fields */ }Expand description
A list that is stored in Redis.
Example
use dtypes::redis::List;
let client = redis::Client::open("redis://localhost:6379").unwrap();
let mut list = List::new("test_list", client);
list.push_back(&1);
list.push_back(&2);
assert_eq!(list.len(), 2);
assert_eq!(list.pop_front(), Some(1));
list.clear();Implementations§
source§impl<T> List<T>where
T: Serialize + DeserializeOwned,
impl<T> List<T>where T: Serialize + DeserializeOwned,
sourcepub fn new(key: &str, client: Client) -> Self
pub fn new(key: &str, client: Client) -> Self
Creates a new List
There is no with_value method like (Generic::with_value)crate::redis::Generic::with_value because it is not possible to
provide a good default behaviour in redis. So you have to think about, how you want to handle
already stored values in redis.
If you want a small performance boost, look at ListCache.
sourcepub fn push_front(&mut self, val: &T)
pub fn push_front(&mut self, val: &T)
Add a value to the front of the list
Auto Trait Implementations§
impl<T> !RefUnwindSafe for List<T>
impl<T> Send for List<T>where T: Send,
impl<T> Sync for List<T>where T: Sync,
impl<T> Unpin for List<T>where T: Unpin,
impl<T> !UnwindSafe for List<T>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more