pub struct RTreeRef<'a, N: IndexableNum> { /* private fields */ }Expand description
Implementations§
Source§impl<'a, N: IndexableNum> RTreeRef<'a, N>
impl<'a, N: IndexableNum> RTreeRef<'a, N>
Sourcepub fn try_new<T: AsRef<[u8]>>(data: &'a T) -> Result<Self, GeoIndexError>
pub fn try_new<T: AsRef<[u8]>>(data: &'a T) -> Result<Self, GeoIndexError>
Construct a new RTree from an external byte slice.
This byte slice must conform to the “flatbush ABI”, that is, the ABI originally implemented
by the JavaScript flatbush library. You can
extract such a buffer either via RTree::into_inner or from the .data attribute
of the JavaScript Flatbush object.
Sourcepub unsafe fn new_unchecked<T: AsRef<[u8]>>(
data: &'a T,
metadata: RTreeMetadata<N>,
) -> Result<Self, GeoIndexError>
pub unsafe fn new_unchecked<T: AsRef<[u8]>>( data: &'a T, metadata: RTreeMetadata<N>, ) -> Result<Self, GeoIndexError>
Construct a new RTreeRef without doing any validation
§Safety
metadata must be valid for this data buffer.
Trait Implementations§
Source§impl<N: IndexableNum> RTreeIndex<N> for RTreeRef<'_, N>
impl<N: IndexableNum> RTreeIndex<N> for RTreeRef<'_, N>
Source§fn boxes(&self) -> &[N]
fn boxes(&self) -> &[N]
A slice representing all the bounding boxes of all elements contained within this tree,
including the bounding boxes of each internal node.
Source§fn indices(&self) -> Indices<'_>
fn indices(&self) -> Indices<'_>
A slice representing the indices within the
boxes slice, including internal nodes.Source§fn metadata(&self) -> &RTreeMetadata<N>
fn metadata(&self) -> &RTreeMetadata<N>
Access the metadata describing this RTree
Source§fn num_nodes(&self) -> usize
fn num_nodes(&self) -> usize
The total number of nodes in this RTree, including both leaf and intermediate nodes.
Source§fn level_bounds(&self) -> &[usize]
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]].Source§fn num_levels(&self) -> usize
fn num_levels(&self) -> usize
The number of levels (height) of the tree.
Source§fn boxes_at_level(&self, level: usize) -> Result<&[N], GeoIndexError>
fn boxes_at_level(&self, level: usize) -> Result<&[N], GeoIndexError>
The tree is laid out from bottom to top. Level 0 is the base of the tree. Each integer
higher is one level higher of the tree.
Source§fn search(&self, min_x: N, min_y: N, max_x: N, max_y: N) -> Vec<u32>
fn search(&self, min_x: N, min_y: N, max_x: N, max_y: N) -> Vec<u32>
Search an RTree given the provided bounding box. Read more
Source§fn search_rect(&self, rect: &impl RectTrait<T = N>) -> Vec<u32>
fn search_rect(&self, rect: &impl RectTrait<T = N>) -> Vec<u32>
Search an RTree given the provided bounding box. Read more
Source§fn neighbors(
&self,
x: N,
y: N,
max_results: Option<usize>,
max_distance: Option<N>,
) -> Vec<u32>
fn neighbors( &self, x: N, y: N, max_results: Option<usize>, max_distance: Option<N>, ) -> Vec<u32>
Search items in order of distance from the given point. Read more
Source§fn neighbors_with_simple_distance<M: SimpleDistanceMetric<N> + ?Sized>(
&self,
x: N,
y: N,
max_results: Option<usize>,
max_distance: Option<N>,
distance_metric: &M,
) -> Vec<u32>
fn neighbors_with_simple_distance<M: SimpleDistanceMetric<N> + ?Sized>( &self, x: N, y: N, max_results: Option<usize>, max_distance: Option<N>, distance_metric: &M, ) -> Vec<u32>
Search items in order of distance from the given point using a simple distance metric. Read more
Source§fn neighbors_coord(
&self,
coord: &impl CoordTrait<T = N>,
max_results: Option<usize>,
max_distance: Option<N>,
) -> Vec<u32>
fn neighbors_coord( &self, coord: &impl CoordTrait<T = N>, max_results: Option<usize>, max_distance: Option<N>, ) -> Vec<u32>
Search items in order of distance from the given coordinate.
Source§fn intersection_candidates_with_other_tree<'a>(
&'a self,
other: &'a impl RTreeIndex<N>,
) -> impl Iterator<Item = (u32, u32)> + 'a
fn intersection_candidates_with_other_tree<'a>( &'a self, other: &'a impl RTreeIndex<N>, ) -> impl Iterator<Item = (u32, u32)> + 'a
Returns an iterator over the indexes of objects in this and another tree that intersect. Read more
impl<'a, N: IndexableNum> StructuralPartialEq for RTreeRef<'a, N>
Auto Trait Implementations§
impl<'a, N> Freeze for RTreeRef<'a, N>
impl<'a, N> RefUnwindSafe for RTreeRef<'a, N>where
N: RefUnwindSafe,
impl<'a, N> Send for RTreeRef<'a, N>
impl<'a, N> Sync for RTreeRef<'a, N>
impl<'a, N> Unpin for RTreeRef<'a, N>where
N: Unpin,
impl<'a, N> UnwindSafe for RTreeRef<'a, N>where
N: RefUnwindSafe + 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