pub struct RangeTree<TOrd: RType> { /* private fields */ }Expand description
Main range-tree structure.
Implementations§
Source§impl<TOrd: RType> RangeTree<TOrd>
impl<TOrd: RType> RangeTree<TOrd>
Sourcepub fn new(range: [TOrd; 2], full: bool) -> RangeTree<TOrd>
pub fn new(range: [TOrd; 2], full: bool) -> RangeTree<TOrd>
Create a new range tree.
rangethe [minimum, maximum] values (inclusive), for this range tree.fullWhen true, the tree is created with all values taken.
Sourcepub fn clear(&mut self, full: bool)
pub fn clear(&mut self, full: bool)
Clear an existing range tree.
fullWhen true, the tree is reset with all values taken.
Sourcepub fn take(&mut self, value: TOrd)
pub fn take(&mut self, value: TOrd)
Take a value from the tree.
Note: taking a value which is already taken will panic.
use retake in cases when its not know.
Sourcepub fn retake(&mut self, value: TOrd) -> bool
pub fn retake(&mut self, value: TOrd) -> bool
Take a value which may already be taken, returning true if the value didn’t already exist in the tree.
Sourcepub fn ranges_taken_as_vec(&self) -> Vec<[TOrd; 2]>
pub fn ranges_taken_as_vec(&self) -> Vec<[TOrd; 2]>
Return a vector containing [minimum, maximum] pairs (inclusive) of contiguous ranges which have been taken.
Sourcepub fn ranges_untaken_as_vec(&self) -> Vec<[TOrd; 2]>
pub fn ranges_untaken_as_vec(&self) -> Vec<[TOrd; 2]>
Return a vector containing [minimum, maximum] pairs (inclusive) of contiguous ranges which have not been taken.
Auto Trait Implementations§
impl<TOrd> Freeze for RangeTree<TOrd>where
TOrd: Freeze,
impl<TOrd> RefUnwindSafe for RangeTree<TOrd>where
TOrd: RefUnwindSafe,
impl<TOrd> !Send for RangeTree<TOrd>
impl<TOrd> !Sync for RangeTree<TOrd>
impl<TOrd> Unpin for RangeTree<TOrd>where
TOrd: Unpin,
impl<TOrd> UnwindSafe for RangeTree<TOrd>where
TOrd: UnwindSafe + RefUnwindSafe,
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