Skip to main content

GeospatialManager

Struct GeospatialManager 

Source
pub struct GeospatialManager { /* private fields */ }

Implementations§

Source§

impl GeospatialManager

Source

pub async fn geoadd( &self, key: &str, locations: Vec<Location>, nx: bool, xx: bool, ch: bool, ) -> Result<usize>

Add geospatial locations (GEOADD)

§Arguments
  • key - Geospatial key
  • locations - Array of locations (lat, lon, member)
  • nx - Only add new elements (don’t update existing)
  • xx - Only update existing elements (don’t add new)
  • ch - Return count of changed elements
§Returns

Number of elements added

Source

pub async fn geodist( &self, key: &str, member1: &str, member2: &str, unit: DistanceUnit, ) -> Result<Option<f64>>

Calculate distance between two members (GEODIST)

§Arguments
  • key - Geospatial key
  • member1 - First member
  • member2 - Second member
  • unit - Distance unit
§Returns

Distance in specified unit, or None if either member doesn’t exist

Source

pub async fn georadius( &self, key: &str, center_lat: f64, center_lon: f64, radius: f64, unit: DistanceUnit, with_dist: bool, with_coord: bool, count: Option<usize>, sort: Option<&str>, ) -> Result<Vec<GeoradiusResult>>

Query members within radius (GEORADIUS)

§Arguments
  • key - Geospatial key
  • center_lat - Center latitude
  • center_lon - Center longitude
  • radius - Radius
  • unit - Distance unit
  • with_dist - Include distance in results
  • with_coord - Include coordinates in results
  • count - Maximum number of results
  • sort - Sort order (“ASC” or “DESC”)
§Returns

Vector of matching members with optional distance and coordinates

Source

pub async fn georadiusbymember( &self, key: &str, member: &str, radius: f64, unit: DistanceUnit, with_dist: bool, with_coord: bool, count: Option<usize>, sort: Option<&str>, ) -> Result<Vec<GeoradiusResult>>

Query members within radius of given member (GEORADIUSBYMEMBER)

§Arguments
  • key - Geospatial key
  • member - Center member
  • radius - Radius
  • unit - Distance unit
  • with_dist - Include distance in results
  • with_coord - Include coordinates in results
  • count - Maximum number of results
  • sort - Sort order (“ASC” or “DESC”)
§Returns

Vector of matching members with optional distance and coordinates

Source

pub async fn geopos( &self, key: &str, members: &[String], ) -> Result<Vec<Option<Coordinate>>>

Get coordinates of members (GEOPOS)

§Arguments
  • key - Geospatial key
  • members - Array of member names
§Returns

Vector of coordinates (None if member doesn’t exist)

Source

pub async fn geosearch( &self, key: &str, from_member: Option<&str>, from_lonlat: Option<(f64, f64)>, by_radius: Option<(f64, DistanceUnit)>, by_box: Option<(f64, f64, DistanceUnit)>, with_dist: bool, with_coord: bool, with_hash: bool, count: Option<usize>, sort: Option<&str>, ) -> Result<Vec<GeoradiusResult>>

Advanced geospatial search (GEOSEARCH)

§Arguments
  • key - Geospatial key
  • from_member - Center member (mutually exclusive with from_lonlat)
  • from_lonlat - Center coordinates as (lon, lat) tuple (mutually exclusive with from_member)
  • by_radius - Search by radius as (radius, unit) tuple
  • by_box - Search by bounding box as (width, height, unit) tuple
  • with_dist - Include distance in results
  • with_coord - Include coordinates in results
  • with_hash - Include geohash in results (not yet implemented)
  • count - Maximum number of results
  • sort - Sort order (“ASC” or “DESC”)
§Returns

Vector of matching members with optional distance and coordinates

Source

pub async fn geohash( &self, key: &str, members: &[String], ) -> Result<Vec<Option<String>>>

Get geohash strings for members (GEOHASH)

§Arguments
  • key - Geospatial key
  • members - Array of member names
§Returns

Vector of geohash strings (None if member doesn’t exist)

Source

pub async fn stats(&self) -> Result<GeospatialStats>

Retrieve geospatial statistics

Trait Implementations§

Source§

impl Clone for GeospatialManager

Source§

fn clone(&self) -> GeospatialManager

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

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
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more