[−][src]Struct quadtree_rs::entry::Entry
A region/value association in the Quadtree
.
Entry
is used both for read-only access into a quadtree (i.e. .get()
) and as the return
type for mutating operations (i.e. .delete()
, which returns iter::IntoIter<U, V>
, which
is iterable over former Entry<U, V>
entries).
use quadtree_rs::{ area::AreaBuilder, Quadtree, }; let mut qt = Quadtree::<u32, f64>::new(4); let region_a = AreaBuilder::default() .anchor((1, 1).into()) .dimensions((3, 2)) .build().unwrap(); qt.insert(region_a, 4.56_f64); // Calling Quadtree::delete() on a region in the tree clears that region of the tree and returns the region/value associations which were deleted. let region_b = AreaBuilder::default() .anchor((2, 1).into()) .build().unwrap(); // The iterator contains Entry<U, V> structs. let mut returned_entries = qt.delete(region_b); let entry = returned_entries.next().unwrap(); assert_eq!(entry.anchor().x(), 1); assert_eq!(entry.anchor().y(), 1); assert_eq!(entry.width(), 3); assert_eq!(entry.height(), 2); assert_eq!(entry.value_ref(), &4.56);
Methods
impl<U, V> Entry<U, V> where
U: PrimInt + Default,
[src]
U: PrimInt + Default,
pub fn area(&self) -> Area<U>
[src]
The returned region.
pub fn anchor(&self) -> Point<U>
[src]
The top-left coordinate of the returned region.
pub fn width(&self) -> U
[src]
The width of the returned region.
pub fn height(&self) -> U
[src]
The height of the returned region.
pub fn value_mut(&mut self) -> &mut V
[src]
A mutable accessor to the returned value.
pub fn value_ref(&self) -> &V
[src]
A reference to the returned value.
Trait Implementations
impl<U: PartialEq, V: PartialEq> PartialEq<Entry<U, V>> for Entry<U, V> where
U: PrimInt + Default,
[src]
U: PrimInt + Default,
impl<U: Eq, V: Eq> Eq for Entry<U, V> where
U: PrimInt + Default,
[src]
U: PrimInt + Default,
impl<U: Debug, V: Debug> Debug for Entry<U, V> where
U: PrimInt + Default,
[src]
U: PrimInt + Default,
Auto Trait Implementations
impl<U, V> Send for Entry<U, V> where
U: Send,
V: Send,
U: Send,
V: Send,
impl<U, V> Sync for Entry<U, V> where
U: Sync,
V: Sync,
U: Sync,
V: Sync,
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,