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§
Source§impl 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§
Source§impl Default for RadiusOptions
impl Default for RadiusOptions
Source§fn default() -> RadiusOptions
fn default() -> RadiusOptions
Returns the “default value” for a type. Read more
Source§impl ToRedisArgs for RadiusOptions
impl ToRedisArgs for RadiusOptions
Source§fn 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
Source§fn num_of_args(&self) -> usize
fn num_of_args(&self) -> usize
Returns the number of arguments this value will generate. Read more
Source§fn 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
Source§fn 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
).Auto Trait Implementations§
impl Freeze for RadiusOptions
impl RefUnwindSafe for RadiusOptions
impl Send for RadiusOptions
impl Sync for RadiusOptions
impl Unpin for RadiusOptions
impl UnwindSafe for RadiusOptions
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