Struct range_map::RangeSet [] [src]

pub struct RangeSet<T> {
    // some fields omitted

A set of integers, implemented as a sorted list of (inclusive) ranges.


impl<T: Debug + PrimInt> RangeSet<T>

fn new() -> RangeSet<T>

Creates a new empty RangeSet.

fn is_empty(&self) -> bool

Tests if this set is empty.

fn is_full(&self) -> bool

Tests whether this set contains every valid value of T.

fn num_ranges(&self) -> usize

Returns the number of ranges used to represent this set.

fn num_elements(&self) -> usize

Returns the number of elements in the set.

This saturates at usize::MAX.

fn ranges<'a>(&'a self) -> RangeIter<'a, T>

Returns an iterator over all ranges in this set.

fn elements<'a>(&'a self) -> EltIter<'a, T>

Returns an iterator over all elements in this set.

fn contains(&self, val: T) -> bool

Checks if this set contains a value.

fn union(&self, other: &RangeSet<T>) -> RangeSet<T>

Returns the union between self and other.

fn full() -> RangeSet<T>

Creates a set that contains every value of T.

fn single(x: T) -> RangeSet<T>

Creates a set containing a single element.

fn except<I: Iterator<Item=T>>(it: I) -> RangeSet<T>

Creates a set containing all elements except the given ones.


  • if chars is not sorted or not unique.

fn intersection(&self, other: &RangeSet<T>) -> RangeSet<T>

Finds the intersection between this set and other.

fn negated(&self) -> RangeSet<T>

Returns the set of all characters that are not in this set.

Trait Implementations

impl<T: PartialEq> PartialEq for RangeSet<T>

fn eq(&self, __arg_0: &RangeSet<T>) -> bool

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, __arg_0: &RangeSet<T>) -> bool

This method tests for !=.

impl<T: Hash> Hash for RangeSet<T>

fn hash<__HT: Hasher>(&self, __arg_0: &mut __HT)

Feeds this value into the state given, updating the hasher as necessary.

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

Feeds a slice of this type into the state provided.

impl<T: Eq> Eq for RangeSet<T>

impl<T: Clone> Clone for RangeSet<T>

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

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

impl<T: Debug + PrimInt> Debug for RangeSet<T>

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

Formats the value using the given formatter.

impl<T: Debug + PrimInt> FromIterator<Range<T>> for RangeSet<T>

fn from_iter<I: IntoIterator<Item=Range<T>>>(iter: I) -> Self

Builds a RangeSet from an iterator over Ranges.