pub struct Commands<'a> { /* private fields */ }Expand description
The group’s commands, run as they are called.
Implementations§
Source§impl Commands<'_>
impl Commands<'_>
Sourcepub async fn lrange<RV: FromRedisValue>(
&self,
key: impl ToRedisArgs,
start: isize,
stop: isize,
) -> Result<RV, Error>
pub async fn lrange<RV: FromRedisValue>( &self, key: impl ToRedisArgs, start: isize, stop: isize, ) -> Result<RV, Error>
The elements from index start to index stop, inclusive. Negative
indexes count from the end: 0, -1 is the whole list.
Sourcepub async fn lindex<RV: FromRedisValue>(
&self,
key: impl ToRedisArgs,
index: isize,
) -> Result<RV, Error>
pub async fn lindex<RV: FromRedisValue>( &self, key: impl ToRedisArgs, index: isize, ) -> Result<RV, Error>
The element at an index.
Sourcepub async fn llen(&self, key: impl ToRedisArgs) -> Result<u64, Error>
pub async fn llen(&self, key: impl ToRedisArgs) -> Result<u64, Error>
How many elements the list has.
Sourcepub async fn lpos(
&self,
key: impl ToRedisArgs,
value: impl ToRedisArgs,
) -> Result<Option<u64>, Error>
pub async fn lpos( &self, key: impl ToRedisArgs, value: impl ToRedisArgs, ) -> Result<Option<u64>, Error>
The index of the first element equal to value.
Sourcepub async fn lpush(
&self,
key: impl ToRedisArgs,
values: impl ToRedisArgs,
) -> Result<u64, Error>
pub async fn lpush( &self, key: impl ToRedisArgs, values: impl ToRedisArgs, ) -> Result<u64, Error>
Prepends the values, returning the list’s new length.
Sourcepub async fn rpush(
&self,
key: impl ToRedisArgs,
values: impl ToRedisArgs,
) -> Result<u64, Error>
pub async fn rpush( &self, key: impl ToRedisArgs, values: impl ToRedisArgs, ) -> Result<u64, Error>
Appends the values, returning the list’s new length.
Sourcepub async fn lpush_exists(
&self,
key: impl ToRedisArgs,
values: impl ToRedisArgs,
) -> Result<u64, Error>
pub async fn lpush_exists( &self, key: impl ToRedisArgs, values: impl ToRedisArgs, ) -> Result<u64, Error>
Prepends the values if the list exists, returning its length.
Sourcepub async fn rpush_exists(
&self,
key: impl ToRedisArgs,
values: impl ToRedisArgs,
) -> Result<u64, Error>
pub async fn rpush_exists( &self, key: impl ToRedisArgs, values: impl ToRedisArgs, ) -> Result<u64, Error>
Appends the values if the list exists, returning its length.
Sourcepub async fn lpop<RV: FromRedisValue>(
&self,
key: impl ToRedisArgs,
count: Option<NonZeroUsize>,
) -> Result<RV, Error>
pub async fn lpop<RV: FromRedisValue>( &self, key: impl ToRedisArgs, count: Option<NonZeroUsize>, ) -> Result<RV, Error>
Removes and returns the first element, or with count that many, as a
list.
Sourcepub async fn rpop<RV: FromRedisValue>(
&self,
key: impl ToRedisArgs,
count: Option<NonZeroUsize>,
) -> Result<RV, Error>
pub async fn rpop<RV: FromRedisValue>( &self, key: impl ToRedisArgs, count: Option<NonZeroUsize>, ) -> Result<RV, Error>
Removes and returns the last element, or with count that many, as a
list.
Sourcepub async fn lset(
&self,
key: impl ToRedisArgs,
index: isize,
value: impl ToRedisArgs,
) -> Result<(), Error>
pub async fn lset( &self, key: impl ToRedisArgs, index: isize, value: impl ToRedisArgs, ) -> Result<(), Error>
Replaces the element at an index.
Sourcepub async fn ltrim(
&self,
key: impl ToRedisArgs,
start: isize,
stop: isize,
) -> Result<(), Error>
pub async fn ltrim( &self, key: impl ToRedisArgs, start: isize, stop: isize, ) -> Result<(), Error>
Keeps only the elements from index start to index stop, inclusive.
Sourcepub async fn linsert_before(
&self,
key: impl ToRedisArgs,
pivot: impl ToRedisArgs,
value: impl ToRedisArgs,
) -> Result<i64, Error>
pub async fn linsert_before( &self, key: impl ToRedisArgs, pivot: impl ToRedisArgs, value: impl ToRedisArgs, ) -> Result<i64, Error>
Inserts the value before the first element equal to pivot, returning
the list’s new length, or -1 if there is no such element.
Sourcepub async fn linsert_after(
&self,
key: impl ToRedisArgs,
pivot: impl ToRedisArgs,
value: impl ToRedisArgs,
) -> Result<i64, Error>
pub async fn linsert_after( &self, key: impl ToRedisArgs, pivot: impl ToRedisArgs, value: impl ToRedisArgs, ) -> Result<i64, Error>
Inserts the value after the first element equal to pivot, returning
the list’s new length, or -1 if there is no such element.
Sourcepub async fn lrem(
&self,
key: impl ToRedisArgs,
count: isize,
value: impl ToRedisArgs,
) -> Result<u64, Error>
pub async fn lrem( &self, key: impl ToRedisArgs, count: isize, value: impl ToRedisArgs, ) -> Result<u64, Error>
Removes elements equal to value: the first count of them, the last
-count if it is negative, or all if it is 0. Returns how many.
Sourcepub async fn lmove<RV: FromRedisValue>(
&self,
source: impl ToRedisArgs,
destination: impl ToRedisArgs,
from: Direction,
to: Direction,
) -> Result<RV, Error>
pub async fn lmove<RV: FromRedisValue>( &self, source: impl ToRedisArgs, destination: impl ToRedisArgs, from: Direction, to: Direction, ) -> Result<RV, Error>
Moves an element from one end of source to one end of destination,
returning it.
Sourcepub async fn blpop<V: FromRedisValue>(
&self,
keys: impl ToRedisArgs,
timeout: f64,
) -> Result<Option<Popped<V>>, Error>
pub async fn blpop<V: FromRedisValue>( &self, keys: impl ToRedisArgs, timeout: f64, ) -> Result<Option<Popped<V>>, Error>
Removes and returns the first element of the first of keys that has
one, with its key, waiting up to timeout seconds for one to be
pushed: 0 waits for ever. None once the timeout passes.
Sourcepub async fn brpop<V: FromRedisValue>(
&self,
keys: impl ToRedisArgs,
timeout: f64,
) -> Result<Option<Popped<V>>, Error>
pub async fn brpop<V: FromRedisValue>( &self, keys: impl ToRedisArgs, timeout: f64, ) -> Result<Option<Popped<V>>, Error>
Commands::blpop, from the end of the list.
Sourcepub async fn blmove<RV: FromRedisValue>(
&self,
source: impl ToRedisArgs,
destination: impl ToRedisArgs,
from: Direction,
to: Direction,
timeout: f64,
) -> Result<RV, Error>
pub async fn blmove<RV: FromRedisValue>( &self, source: impl ToRedisArgs, destination: impl ToRedisArgs, from: Direction, to: Direction, timeout: f64, ) -> Result<RV, Error>
Commands::lmove, waiting up to timeout seconds for source to
have an element: 0 waits for ever. A nil reply, which reads as None,
once the timeout passes.
Sourcepub async fn blmpop<V: FromRedisValue>(
&self,
timeout: f64,
keys: impl ToRedisArgs,
from: Direction,
count: usize,
) -> Result<Option<PoppedMany<V>>, Error>
pub async fn blmpop<V: FromRedisValue>( &self, timeout: f64, keys: impl ToRedisArgs, from: Direction, count: usize, ) -> Result<Option<PoppedMany<V>>, Error>
Removes and returns up to count elements from one end of the first
of keys that has any, with its key, waiting up to timeout
seconds for one: 0 waits for ever. None once the timeout passes.
Trait Implementations§
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for Commands<'a>
impl<'a> !UnwindSafe for Commands<'a>
impl<'a> Forget for Commands<'a>
impl<'a> Freeze for Commands<'a>
impl<'a> Move for Commands<'a>
impl<'a> Send for Commands<'a>
impl<'a> Sync for Commands<'a>
impl<'a> Unpin for Commands<'a>
impl<'a> UnsafeUnpin for Commands<'a>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request