Struct redis::geo::RadiusOptions
source · [−]pub struct RadiusOptions { /* private fields */ }
Expand description
Options for the GEORADIUS and GEORADIUSBYMEMBER commands
Example
use redis::{Commands, RedisResult};
use redis::geo::{RadiusSearchResult, RadiusOptions, RadiusOrder, Unit};
fn nearest_in_radius(
con: &mut redis::Connection,
key: &str,
longitude: f64,
latitude: f64,
meters: f64,
limit: usize,
) -> RedisResult<Vec<RadiusSearchResult>> {
let opts = RadiusOptions::default()
.order(RadiusOrder::Asc)
.limit(limit);
con.geo_radius(key, longitude, latitude, meters, Unit::Meters, opts)
}
Implementations
sourceimpl RadiusOptions
impl RadiusOptions
sourcepub fn with_dist(self) -> Self
pub fn with_dist(self) -> Self
Return the distance of the returned items from the specified center. The distance is returned in the same unit as the unit specified as the radius argument of the command.
sourcepub fn with_coord(self) -> Self
pub fn with_coord(self) -> Self
Return the longitude, latitude
coordinates of the matching items.
sourcepub fn order(self, o: RadiusOrder) -> Self
pub fn order(self, o: RadiusOrder) -> Self
Sort the returned items
sourcepub fn store<K: ToRedisArgs>(self, key: K) -> Self
pub fn store<K: ToRedisArgs>(self, key: K) -> Self
Store the results in a sorted set at key
, instead of returning them.
This feature can’t be used with any with_*
method.
sourcepub fn store_dist<K: ToRedisArgs>(self, key: K) -> Self
pub fn store_dist<K: ToRedisArgs>(self, key: K) -> Self
Store the results in a sorted set at key
, with the distance from the
center as its score. This feature can’t be used with any with_*
method.
Trait Implementations
sourceimpl Default for RadiusOptions
impl Default for RadiusOptions
sourcefn default() -> RadiusOptions
fn default() -> RadiusOptions
Returns the “default value” for a type. Read more
sourceimpl ToRedisArgs for RadiusOptions
impl ToRedisArgs for RadiusOptions
sourcefn write_redis_args<W>(&self, out: &mut W) where
W: ?Sized + RedisWrite,
fn write_redis_args<W>(&self, out: &mut W) where
W: ?Sized + RedisWrite,
This writes the value into a vector of bytes. Each item is a single argument. Most items generate a single item. Read more
sourcefn is_single_arg(&self) -> bool
fn is_single_arg(&self) -> bool
Returns an indiciation if the value contained is exactly one
argument. It returns false if it’s zero or more than one. This
is used in some high level functions to intelligently switch
between GET
and MGET
variants. Read more
sourcefn to_redis_args(&self) -> Vec<Vec<u8>>
fn to_redis_args(&self) -> Vec<Vec<u8>>
This converts the value into a vector of bytes. Each item is a single argument. Most items generate a vector of a single item. Read more
sourcefn describe_numeric_behavior(&self) -> NumericBehavior
fn describe_numeric_behavior(&self) -> NumericBehavior
Returns an information about the contained value with regards
to it’s numeric behavior in a redis context. This is used in
some high level concepts to switch between different implementations
of redis functions (for instance INCR
vs INCRBYFLOAT
). Read more
Auto Trait Implementations
impl RefUnwindSafe for RadiusOptions
impl Send for RadiusOptions
impl Sync for RadiusOptions
impl Unpin for RadiusOptions
impl UnwindSafe for RadiusOptions
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
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