RTreeRef

Struct RTreeRef 

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

A reference on an external RTree buffer.

Usually this will be created from an RTree via its as_ref method, but it can also be created from any existing data buffer.

Implementations§

Source§

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

Source

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.

Source

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<'a, N: Clone + IndexableNum> Clone for RTreeRef<'a, N>

Source§

fn clone(&self) -> RTreeRef<'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 RTreeRef<'a, N>

Source§

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

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

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

Source§

fn eq(&self, other: &RTreeRef<'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<N: IndexableNum> RTreeIndex<N> for RTreeRef<'_, N>

Source§

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<'_>

A slice representing the indices within the boxes slice, including internal nodes.
Source§

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

Access the metadata describing this RTree
Source§

fn num_items(&self) -> u32

The total number of items contained in this RTree.
Source§

fn num_nodes(&self) -> usize

The total number of nodes in this RTree, including both leaf and intermediate nodes.
Source§

fn node_size(&self) -> u16

The maximum number of elements in each node.
Source§

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

The number of levels (height) of the tree.
Source§

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>

Search an RTree given the provided bounding box. Read more
Source§

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>

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>

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>

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

Returns an iterator over the indexes of objects in this and another tree that intersect. Read more
Source§

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

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

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>

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.