KDTreeBuilder

Struct KDTreeBuilder 

Source
pub struct KDTreeBuilder<N: IndexableNum> { /* private fields */ }
Expand description

A builder to create an KDTree.

Implementations§

Source§

impl<N: IndexableNum> KDTreeBuilder<N>

Source

pub fn new(num_items: u32) -> Self

Create a new builder with the provided number of items and the default node size.

Source

pub fn new_with_node_size(num_items: u32, node_size: u16) -> Self

Create a new builder with the provided number of items and node size.

Source

pub fn from_metadata(metadata: KDTreeMetadata<N>) -> Self

Create a new builder with the provided metadata

Source

pub fn metadata(&self) -> &KDTreeMetadata<N>

Access the underlying KDTreeMetadata of this instance.

Source

pub fn add(&mut self, x: N, y: N) -> u32

Add a point to the KDTree.

This returns a positional index that provides a lookup back into the original data.

Source

pub fn add_coord(&mut self, coord: &impl CoordTrait<T = N>) -> u32

Add a coord to the KDTree.

This returns a positional index that provides a lookup back into the original data.

Source

pub fn add_point( &mut self, point: &impl PointTrait<T = N>, ) -> Result<u32, GeoIndexError>

Add a point to the KDTree.

This returns a positional index that provides a lookup back into the original data.

§Errors
  • If the point is empty.
Source

pub fn finish(self) -> KDTree<N>

Consume this builder, perfoming the k-d sort and generating a KDTree ready for queries.

Trait Implementations§

Source§

impl<N: Debug + IndexableNum> Debug for KDTreeBuilder<N>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<N> Freeze for KDTreeBuilder<N>

§

impl<N> RefUnwindSafe for KDTreeBuilder<N>
where N: RefUnwindSafe,

§

impl<N> Send for KDTreeBuilder<N>

§

impl<N> Sync for KDTreeBuilder<N>

§

impl<N> Unpin for KDTreeBuilder<N>
where N: Unpin,

§

impl<N> UnwindSafe for KDTreeBuilder<N>
where N: 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> 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, 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.