Struct rangemap::RangeSet [−][src]
A set whose items are stored as (half-open) ranges bounded
inclusively below and exclusively above (start..end)
.
See RangeMap
's documentation for more details.
Implementations
impl<T> RangeSet<T> where
T: Ord + Clone,
[src]
T: Ord + Clone,
pub fn new() -> Self
[src]
Makes a new empty RangeSet
.
pub fn get(&self, value: &T) -> Option<&Range<T>>
[src]
Returns a reference to the range covering the given key, if any.
pub fn contains(&self, value: &T) -> bool
[src]
Returns true
if any range in the set covers the specified value.
pub fn iter(&self) -> impl Iterator<Item = &Range<T>>
[src]
Gets an ordered iterator over all ranges, ordered by range.
pub fn insert(&mut self, range: Range<T>)
[src]
Insert a range into the set.
If the inserted range either overlaps or is immediately adjacent any existing range, then the ranges will be coalesced into a single contiguous range.
Panics
Panics if range start >= end
.
pub fn remove(&mut self, range: Range<T>)
[src]
Removes a range from the set, if all or any of it was present.
If the range to be removed partially overlaps any ranges in the set, then those ranges will be contracted to no longer cover the removed range.
Panics
Panics if range start >= end
.
pub fn gaps<'a>(&'a self, outer_range: &'a Range<T>) -> Gaps<'a, T>
[src]
Gets an iterator over all the maximally-sized ranges
contained in outer_range
that are not covered by
any range stored in the set.
The iterator element type is Range<T>
.
NOTE: Calling gaps
eagerly finds the first gap,
even if the iterator is never consumed.
Trait Implementations
impl<T: Clone> Clone for RangeSet<T>
[src]
impl<T: Debug> Debug for RangeSet<T> where
T: Ord + Clone,
[src]
T: Ord + Clone,
impl<T> Default for RangeSet<T> where
T: Ord + Clone,
[src]
T: Ord + Clone,
Auto Trait Implementations
impl<T> RefUnwindSafe for RangeSet<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for RangeSet<T> where
T: Send,
T: Send,
impl<T> Sync for RangeSet<T> where
T: Sync,
T: Sync,
impl<T> Unpin for RangeSet<T>
impl<T> UnwindSafe for RangeSet<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,