pub struct RTreeMetadata<N: IndexableNum> { /* private fields */ }Expand description
Common metadata to describe an RTree
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> RTreeMetadata<N>
impl<N: IndexableNum> RTreeMetadata<N>
Sourcepub fn new(num_items: u32, node_size: u16) -> Self
pub fn new(num_items: u32, node_size: u16) -> Self
Construct a new RTreeMetadata 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 RTreeMetadata from an existing byte slice conforming to the “flatbush
ABI”, such as what [RTreeBuilder] generates.
Sourcepub fn level_bounds(&self) -> &[usize]
pub fn level_bounds(&self) -> &[usize]
The offsets into RTreeIndex::boxes where each level’s
boxes starts and ends. The tree is laid out bottom-up, and there’s an implicit initial 0.
So the boxes of the lowest level of the tree are located from
boxes[0..self.level_bounds()[0]].
Sourcepub fn data_buffer_length(&self) -> usize
pub fn data_buffer_length(&self) -> usize
The number of bytes that an RTree with this metadata would have.
use geo_index::rtree::RTreeMetadata;
let metadata = RTreeMetadata::<f64>::new(25000, 16);
assert_eq!(metadata.data_buffer_length(), 960_092);Sourcepub fn boxes_slice<'a>(&self, data: &'a [u8]) -> &'a [N]
pub fn boxes_slice<'a>(&self, data: &'a [u8]) -> &'a [N]
Access the slice of boxes 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 RTreeMetadata<N>
impl<N: Clone + IndexableNum> Clone for RTreeMetadata<N>
Source§fn clone(&self) -> RTreeMetadata<N>
fn clone(&self) -> RTreeMetadata<N>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more