Struct redis_driver::ZRange
source · [−]pub struct ZRange<'a, T>where
T: SortedSetCommands + ?Sized,{ /* private fields */ }
Expand description
Builder for the zrange command
Implementations
sourceimpl<'a, T> ZRange<'a, T>where
T: SortedSetCommands + ?Sized,
impl<'a, T> ZRange<'a, T>where
T: SortedSetCommands + ?Sized,
sourcepub fn sort_by(self, sort_by: ZRangeSortBy) -> Self
pub fn sort_by(self, sort_by: ZRangeSortBy) -> Self
When the ByScore
option is provided, the command behaves like ZRANGEBYSCORE
and returns
the range of elements from the sorted set having scores equal or between start
and stop
.
When the ByLex
option is used, the command behaves like ZRANGEBYLEX
and returns the range
of elements from the sorted set between the start
and stop
lexicographical closed range intervals.
sourcepub fn rev(self) -> Self
pub fn rev(self) -> Self
Using the REV option reverses the sorted set, with index 0 as the element with the highest score.
sourcepub fn limit(self, offset: usize, count: isize) -> Self
pub fn limit(self, offset: usize, count: isize) -> Self
The optional LIMIT argument can be used to obtain a sub-range from the matching elements (similar to SELECT LIMIT offset, count in SQL).
A negative count
returns all elements from the offset
.
Keep in mind that if offset
is large, the sorted set needs to be traversed for offset
elements before getting to the elements to return, which can add up to O(N) time complexity.
sourcepub fn execute<E>(self) -> Pin<Box<dyn Future<Output = Result<Vec<E>>> + 'a>>where
E: FromValue,
pub fn execute<E>(self) -> Pin<Box<dyn Future<Output = Result<Vec<E>>> + 'a>>where
E: FromValue,
Return
list of elements in the specified range
sourcepub fn with_scores<E>(
self
) -> Pin<Box<dyn Future<Output = Result<Vec<(E, f64)>>> + 'a>>where
E: FromValue,
pub fn with_scores<E>(
self
) -> Pin<Box<dyn Future<Output = Result<Vec<(E, f64)>>> + 'a>>where
E: FromValue,
The optional WITHSCORES
argument supplements the command’s reply with the scores of elements returned.
The returned list contains value1,score1,…,valueN,scoreN instead of value1,…,valueN.
Return
list of elements and their scores in the specified range
Auto Trait Implementations
impl<'a, T: ?Sized> RefUnwindSafe for ZRange<'a, T>where
T: RefUnwindSafe,
impl<'a, T: ?Sized> Send for ZRange<'a, T>where
T: Sync,
impl<'a, T: ?Sized> Sync for ZRange<'a, T>where
T: Sync,
impl<'a, T: ?Sized> Unpin for ZRange<'a, T>
impl<'a, T: ?Sized> UnwindSafe for ZRange<'a, T>where
T: RefUnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more