pub struct CachedEnvelope<T: RTreeObject> { /* private fields */ }
Expand description

An RTreeObject with an inner geometry whose envelope is cached to improve efficiency.

For complex geometry like polygons, computing the envelope can become a bottleneck during tree construction and querying. Hence this combinator computes it once during creation, stores it and then returns a copy.

Note: the container itself implements RTreeObject and inner geometry T can be accessed via an implementation of Deref<Target=T>.

Implementations§

source§

impl<T: RTreeObject> CachedEnvelope<T>

source

pub fn new(inner: T) -> Self

Create a new CachedEnvelope struct using the provided geometry.

Trait Implementations§

source§

impl<T: Clone + RTreeObject> Clone for CachedEnvelope<T>
where T::Envelope: Clone,

source§

fn clone(&self) -> CachedEnvelope<T>

Returns a copy 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<T: Debug + RTreeObject> Debug for CachedEnvelope<T>
where T::Envelope: Debug,

source§

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

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

impl<T: Default + RTreeObject> Default for CachedEnvelope<T>
where T::Envelope: Default,

source§

fn default() -> CachedEnvelope<T>

Returns the “default value” for a type. Read more
source§

impl<T: RTreeObject> Deref for CachedEnvelope<T>

§

type Target = T

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<T: Hash + RTreeObject> Hash for CachedEnvelope<T>
where T::Envelope: Hash,

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<T: Ord + RTreeObject> Ord for CachedEnvelope<T>
where T::Envelope: Ord,

source§

fn cmp(&self, other: &CachedEnvelope<T>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl<T: PartialEq + RTreeObject> PartialEq for CachedEnvelope<T>
where T::Envelope: PartialEq,

source§

fn eq(&self, other: &CachedEnvelope<T>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T: PartialOrd + RTreeObject> PartialOrd for CachedEnvelope<T>
where T::Envelope: PartialOrd,

source§

fn partial_cmp(&self, other: &CachedEnvelope<T>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<T: PointDistance> PointDistance for CachedEnvelope<T>

source§

fn distance_2( &self, point: &<Self::Envelope as Envelope>::Point ) -> <<Self::Envelope as Envelope>::Point as Point>::Scalar

Returns the squared distance between an object and a point. Read more
source§

fn contains_point(&self, p: &<Self::Envelope as Envelope>::Point) -> bool

Returns true if a point is contained within this object. Read more
source§

fn distance_2_if_less_or_equal( &self, point: &<Self::Envelope as Envelope>::Point, max_distance_2: <<Self::Envelope as Envelope>::Point as Point>::Scalar ) -> Option<<<Self::Envelope as Envelope>::Point as Point>::Scalar>

Returns the squared distance to this object, or None if the distance is larger than a given maximum value. Read more
source§

impl<T: RTreeObject> RTreeObject for CachedEnvelope<T>
where T::Envelope: Clone,

§

type Envelope = <T as RTreeObject>::Envelope

The object’s envelope type. Usually, AABB will be the right choice. This type also defines the object’s dimensionality.
source§

fn envelope(&self) -> Self::Envelope

Returns the object’s envelope. Read more
source§

impl<T: Copy + RTreeObject> Copy for CachedEnvelope<T>
where T::Envelope: Copy,

source§

impl<T: Eq + RTreeObject> Eq for CachedEnvelope<T>
where T::Envelope: Eq,

source§

impl<T: RTreeObject> StructuralPartialEq for CachedEnvelope<T>

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for CachedEnvelope<T>

§

impl<T> Send for CachedEnvelope<T>
where T: Send, <T as RTreeObject>::Envelope: Send,

§

impl<T> Sync for CachedEnvelope<T>
where T: Sync, <T as RTreeObject>::Envelope: Sync,

§

impl<T> Unpin for CachedEnvelope<T>
where T: Unpin, <T as RTreeObject>::Envelope: Unpin,

§

impl<T> UnwindSafe for CachedEnvelope<T>

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> 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,

§

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>,

§

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>,

§

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.