Struct bktree::BkTree[][src]

pub struct BkTree<T> { /* fields omitted */ }
Expand description

A BK-tree datastructure

Implementations

impl<T> BkTree<T>[src]

pub fn new(dist: impl Fn(&T, &T) -> isize + 'static) -> Self[src]

Create a new BK-tree with a given distance function

pub fn insert_all<I: IntoIterator<Item = T>>(&mut self, iter: I)[src]

Insert every element from a given iterator in the BK-tree

pub fn insert(&mut self, val: T)[src]

Insert a new element in the BK-tree

pub fn find(&self, val: T, max_dist: isize) -> Vec<(&T, isize)>[src]

Find the closest elements to a given value present in the BK-tree

Returns pairs of element references and distances

pub fn into_iter(self) -> IntoIter<T>

Notable traits for IntoIter<T>

impl<T> Iterator for IntoIter<T> type Item = T;
[src]

Convert the BK-tree into an iterator over its elements, in no particular order

pub fn iter(&self) -> Iter<'_, T>

Notable traits for Iter<'a, T>

impl<'a, T> Iterator for Iter<'a, T> type Item = &'a T;
[src]

Create an iterator over references of BK-tree elements, in no particular order

Trait Implementations

impl<T> IntoIterator for BkTree<T>[src]

type Item = T

The type of the elements being iterated over.

type IntoIter = IntoIter<T>

Which kind of iterator are we turning this into?

fn into_iter(self) -> Self::IntoIter[src]

Creates an iterator from a value. Read more

Auto Trait Implementations

impl<T> !RefUnwindSafe for BkTree<T>

impl<T> !Send for BkTree<T>

impl<T> !Sync for BkTree<T>

impl<T> Unpin for BkTree<T>

impl<T> !UnwindSafe for BkTree<T>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

Performs the conversion.