pub struct KDTreeMetadata<N: IndexableNum> { /* private fields */ }
Expand description
Common metadata to describe a KDTree
You can use the metadata to infer the total byte size of a tree given the provided criteria.
See data_buffer_length
.
Implementations§
Source§impl<N: IndexableNum> KDTreeMetadata<N>
impl<N: IndexableNum> KDTreeMetadata<N>
Sourcepub fn new(num_items: u32, node_size: u16) -> Self
pub fn new(num_items: u32, node_size: u16) -> Self
Construct a new KDTreeMetadata
from a number of items and node size.
Sourcepub fn from_slice(data: &[u8]) -> Result<Self, GeoIndexError>
pub fn from_slice(data: &[u8]) -> Result<Self, GeoIndexError>
Construct a new KDTreeMetadata
from an existing byte slice conforming to the “kdbush
ABI”, such as what [KDTreeBuilder
] generates.
Sourcepub fn data_buffer_length(&self) -> usize
pub fn data_buffer_length(&self) -> usize
The number of bytes that a KDTree with this metadata would have.
use geo_index::kdtree::KDTreeMetadata;
let metadata = KDTreeMetadata::<f64>::new(25000, 16);
assert_eq!(metadata.data_buffer_length(), 450_008);
Sourcepub fn coords_slice<'a>(&self, data: &'a [u8]) -> &'a [N]
pub fn coords_slice<'a>(&self, data: &'a [u8]) -> &'a [N]
Access the slice of coordinates from the data buffer this metadata represents.
Sourcepub fn indices_slice<'a>(&self, data: &'a [u8]) -> Indices<'a>
pub fn indices_slice<'a>(&self, data: &'a [u8]) -> Indices<'a>
Access the slice of indices from the data buffer this metadata represents.
Trait Implementations§
Source§impl<N: Clone + IndexableNum> Clone for KDTreeMetadata<N>
impl<N: Clone + IndexableNum> Clone for KDTreeMetadata<N>
Source§fn clone(&self) -> KDTreeMetadata<N>
fn clone(&self) -> KDTreeMetadata<N>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<N: Debug + IndexableNum> Debug for KDTreeMetadata<N>
impl<N: Debug + IndexableNum> Debug for KDTreeMetadata<N>
Source§impl<N: PartialEq + IndexableNum> PartialEq for KDTreeMetadata<N>
impl<N: PartialEq + IndexableNum> PartialEq for KDTreeMetadata<N>
impl<N: Copy + IndexableNum> Copy for KDTreeMetadata<N>
impl<N: IndexableNum> StructuralPartialEq for KDTreeMetadata<N>
Auto Trait Implementations§
impl<N> Freeze for KDTreeMetadata<N>
impl<N> RefUnwindSafe for KDTreeMetadata<N>where
N: RefUnwindSafe,
impl<N> Send for KDTreeMetadata<N>
impl<N> Sync for KDTreeMetadata<N>
impl<N> Unpin for KDTreeMetadata<N>where
N: Unpin,
impl<N> UnwindSafe for KDTreeMetadata<N>where
N: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more