pub struct ListManager { /* private fields */ }Expand description
List data structure interface (Redis-compatible)
List is a doubly-linked list with O(1) push/pop at both ends.
Implementations§
Source§impl ListManager
impl ListManager
Sourcepub async fn lpush<K>(&self, key: K, values: Vec<String>) -> Result<usize>
pub async fn lpush<K>(&self, key: K, values: Vec<String>) -> Result<usize>
Push elements to left (head) of list
Sourcepub async fn rpush<K>(&self, key: K, values: Vec<String>) -> Result<usize>
pub async fn rpush<K>(&self, key: K, values: Vec<String>) -> Result<usize>
Push elements to right (tail) of list
Sourcepub async fn lpop<K>(&self, key: K, count: Option<usize>) -> Result<Vec<String>>
pub async fn lpop<K>(&self, key: K, count: Option<usize>) -> Result<Vec<String>>
Pop elements from left (head) of list
§Arguments
key- The list keycount- Number of elements to pop (optional, defaults to 1)
Sourcepub async fn rpop<K>(&self, key: K, count: Option<usize>) -> Result<Vec<String>>
pub async fn rpop<K>(&self, key: K, count: Option<usize>) -> Result<Vec<String>>
Pop elements from right (tail) of list
§Arguments
key- The list keycount- Number of elements to pop (optional, defaults to 1)
Sourcepub async fn range<K>(
&self,
key: K,
start: i64,
stop: i64,
) -> Result<Vec<String>>
pub async fn range<K>( &self, key: K, start: i64, stop: i64, ) -> Result<Vec<String>>
Get range of elements from list
Sourcepub async fn index<K>(&self, key: K, index: i64) -> Result<Option<String>>
pub async fn index<K>(&self, key: K, index: i64) -> Result<Option<String>>
Get element at index
Sourcepub async fn set<K>(&self, key: K, index: i64, value: String) -> Result<bool>
pub async fn set<K>(&self, key: K, index: i64, value: String) -> Result<bool>
Set element at index
Sourcepub async fn trim<K>(&self, key: K, start: i64, stop: i64) -> Result<bool>
pub async fn trim<K>(&self, key: K, start: i64, stop: i64) -> Result<bool>
Trim list to specified range
Sourcepub async fn rem<K>(&self, key: K, count: i64, value: String) -> Result<usize>
pub async fn rem<K>(&self, key: K, count: i64, value: String) -> Result<usize>
Remove elements from list
Sourcepub async fn insert<K>(
&self,
key: K,
position: &str,
pivot: String,
value: String,
) -> Result<i64>
pub async fn insert<K>( &self, key: K, position: &str, pivot: String, value: String, ) -> Result<i64>
Insert element before/after pivot
Sourcepub async fn rpoplpush<S, D>(
&self,
source: S,
destination: D,
) -> Result<Option<String>>
pub async fn rpoplpush<S, D>( &self, source: S, destination: D, ) -> Result<Option<String>>
Pop from source and push to destination (atomic)
Sourcepub async fn pos<K>(
&self,
key: K,
element: String,
rank: i64,
) -> Result<Option<i64>>
pub async fn pos<K>( &self, key: K, element: String, rank: i64, ) -> Result<Option<i64>>
Find first position of element
Trait Implementations§
Source§impl Clone for ListManager
impl Clone for ListManager
Source§fn clone(&self) -> ListManager
fn clone(&self) -> ListManager
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ListManager
impl !RefUnwindSafe for ListManager
impl Send for ListManager
impl Sync for ListManager
impl Unpin for ListManager
impl UnsafeUnpin for ListManager
impl !UnwindSafe for ListManager
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