Struct KdTree

Source
pub struct KdTree<A, T: PartialEq, U: AsRef<[A]> + PartialEq> { /* private fields */ }

Implementations§

Source§

impl<A: Float + Zero + One, T: PartialEq, U: AsRef<[A]> + PartialEq> KdTree<A, T, U>

Source

pub fn new(dims: usize) -> Self

Create a new KD tree, specifying the dimension size of each point

Source

pub fn with_capacity(dimensions: usize, capacity: usize) -> Self

Create a new KD tree, specifying the dimension size of each point and the capacity of leaf nodes

Source

pub fn size(&self) -> usize

Source

pub fn nearest<F>( &self, point: &[A], num: usize, distance: &F, ) -> Result<Vec<(A, &T)>, ErrorKind>
where F: Fn(&[A], &[A]) -> A,

Source

pub fn within<F>( &self, point: &[A], radius: A, distance: &F, ) -> Result<Vec<(A, &T)>, ErrorKind>
where F: Fn(&[A], &[A]) -> A,

Source

pub fn iter_nearest<'a, 'b, F>( &'b self, point: &'a [A], distance: &'a F, ) -> Result<NearestIter<'a, 'b, A, T, U, F>, ErrorKind>
where F: Fn(&[A], &[A]) -> A,

Source

pub fn iter_nearest_mut<'a, 'b, F>( &'b mut self, point: &'a [A], distance: &'a F, ) -> Result<NearestIterMut<'a, 'b, A, T, U, F>, ErrorKind>
where F: Fn(&[A], &[A]) -> A,

Source

pub fn add(&mut self, point: U, data: T) -> Result<(), ErrorKind>

Source

pub fn remove(&mut self, point: &U, data: &T) -> Result<usize, ErrorKind>

Trait Implementations§

Source§

impl<A: Clone, T: Clone + PartialEq, U: Clone + AsRef<[A]> + PartialEq> Clone for KdTree<A, T, U>

Source§

fn clone(&self) -> KdTree<A, T, U>

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<A: Debug, T: Debug + PartialEq, U: Debug + AsRef<[A]> + PartialEq> Debug for KdTree<A, T, U>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<A, T, U> Freeze for KdTree<A, T, U>
where A: Freeze,

§

impl<A, T, U> RefUnwindSafe for KdTree<A, T, U>

§

impl<A, T, U> Send for KdTree<A, T, U>
where A: Send, U: Send, T: Send,

§

impl<A, T, U> Sync for KdTree<A, T, U>
where A: Sync, U: Sync, T: Sync,

§

impl<A, T, U> Unpin for KdTree<A, T, U>
where A: Unpin, U: Unpin, T: Unpin,

§

impl<A, T, U> UnwindSafe for KdTree<A, T, U>
where A: UnwindSafe, U: UnwindSafe, T: UnwindSafe,

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.