Struct rangemap::RangeSet[][src]

pub struct RangeSet<T> { /* fields omitted */ }

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]

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]

impl<T> Default for RangeSet<T> where
    T: Ord + Clone
[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for RangeSet<T> where
    T: RefUnwindSafe

impl<T> Send for RangeSet<T> where
    T: Send

impl<T> Sync for RangeSet<T> where
    T: Sync

impl<T> Unpin for RangeSet<T>

impl<T> UnwindSafe for RangeSet<T> where
    T: RefUnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.