Struct Query

Source
pub struct Query<'tree, P, V> { /* private fields */ }
Expand description

A context for repeated nearest-neighbor queries that internally re-uses memory across queries.

Implementations§

Source§

impl<'tree, P: Point, V> Query<'tree, P, V>

Source

pub fn nn<'query>( &'query mut self, point: &'query P, ) -> Iter<'tree, 'query, P, V>

Given a point, return an Iterator that yields neighbors from closest to farthest. To get the K nearest neighbors, simply take K from the iterator.

The neighbor, its distance, and associated value are returned.

Source

pub fn nn_within<'query>( &'query mut self, point: &'query P, max_radius: f64, ) -> Iter<'tree, 'query, P, V>

The same as nn but only consider neighbors whose distance is <= max_radius.

Source

pub fn min_radius<'query>(&'query mut self, point: &'query P, k: usize) -> f64

What is the minimum radius that encompasses k neighbors of point?

Source

pub fn count<'query>( &'query mut self, point: &'query P, max_radius: f64, ) -> usize

How many neighbors are <= max_radius of point?

Source

pub fn allocated_size(&self) -> usize

Return the size in bytes of the memory this Query is keeping internally to avoid allocation.

Source

pub fn deallocate_memory(&mut self)

The Query object re-uses memory internally to avoid allocation. This method deallocates that memory.

Trait Implementations§

Source§

impl<'tree, P: Clone, V: Clone> Clone for Query<'tree, P, V>

Source§

fn clone(&self) -> Query<'tree, P, V>

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

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

Performs copy-assignment from source. Read more
Source§

impl<'tree, P: Debug, V: Debug> Debug for Query<'tree, P, V>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'tree, P, V> Freeze for Query<'tree, P, V>

§

impl<'tree, P, V> RefUnwindSafe for Query<'tree, P, V>

§

impl<'tree, P, V> Send for Query<'tree, P, V>
where P: Sync, V: Sync,

§

impl<'tree, P, V> Sync for Query<'tree, P, V>
where P: Sync, V: Sync,

§

impl<'tree, P, V> Unpin for Query<'tree, P, V>

§

impl<'tree, P, V> UnwindSafe for Query<'tree, P, V>

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, 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> 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.