KDTreeRef

Struct KDTreeRef 

Source
pub struct KDTreeRef<'a, N: IndexableNum> { /* private fields */ }
Expand description

A reference on an external KDTree buffer.

Implementations§

Source§

impl<'a, N: IndexableNum> KDTreeRef<'a, N>

Source

pub fn try_new<T: AsRef<[u8]>>(data: &'a T) -> Result<Self, GeoIndexError>

Construct a new KDTreeRef from an external byte slice.

This byte slice must conform to the “kdbush ABI”, that is, the ABI originally implemented by the JavaScript kdbush library. You can extract such a buffer either via KDTree::into_inner or from the .data attribute of the JavaScript KDBush object.

Source

pub unsafe fn new_unchecked<T: AsRef<[u8]>>( data: &'a T, metadata: KDTreeMetadata<N>, ) -> Result<Self, GeoIndexError>

Construct a new KDTreeRef without doing any validation

§Safety

metadata must be valid for this data buffer.

Trait Implementations§

Source§

impl<'a, N: Clone + IndexableNum> Clone for KDTreeRef<'a, N>

Source§

fn clone(&self) -> KDTreeRef<'a, N>

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

impl<'a, N: Debug + IndexableNum> Debug for KDTreeRef<'a, N>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<N: IndexableNum> KDTreeIndex<N> for KDTreeRef<'_, N>

Source§

fn coords(&self) -> &[N]

The underlying raw coordinate buffer of this tree
Source§

fn indices(&self) -> Indices<'_>

The underlying raw indices buffer of this tree
Source§

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

Access the metadata describing this KDTree
Source§

fn num_items(&self) -> u32

The number of items in this KDTree
Source§

fn node_size(&self) -> u16

The node size of this KDTree
Source§

fn range(&self, min_x: N, min_y: N, max_x: N, max_y: N) -> Vec<u32>

Search the index for items within a given bounding box. Read more
Source§

fn range_rect(&self, rect: &impl RectTrait<T = N>) -> Vec<u32>

Search the index for items within a given bounding box. Read more
Source§

fn within(&self, qx: N, qy: N, r: N) -> Vec<u32>

Search the index for items within a given radius. Read more
Source§

fn within_coord(&self, coord: &impl CoordTrait<T = N>, r: N) -> Vec<u32>

Search the index for items within a given radius. Read more
Source§

fn root(&self) -> Node<'_, N, Self>

Access the root node of the KDTree for manual traversal.
Source§

impl<'a, N: PartialEq + IndexableNum> PartialEq for KDTreeRef<'a, N>

Source§

fn eq(&self, other: &KDTreeRef<'a, N>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a, N: IndexableNum> StructuralPartialEq for KDTreeRef<'a, N>

Auto Trait Implementations§

§

impl<'a, N> Freeze for KDTreeRef<'a, N>

§

impl<'a, N> RefUnwindSafe for KDTreeRef<'a, N>
where N: RefUnwindSafe,

§

impl<'a, N> Send for KDTreeRef<'a, N>

§

impl<'a, N> Sync for KDTreeRef<'a, N>

§

impl<'a, N> Unpin for KDTreeRef<'a, N>
where N: Unpin,

§

impl<'a, N> UnwindSafe for KDTreeRef<'a, N>

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.