Struct range_map::RangeMultiMap [] [src]

pub struct RangeMultiMap<T, V> {
    // some fields omitted

A multi-valued mapping from primitive integers to other data.


impl<T: Debug + PrimInt, V: Clone + Debug + PartialEq> RangeMultiMap<T, V>

fn new() -> RangeMultiMap<T, V>

Creates a new empty map.

fn num_ranges(&self) -> usize

Returns the number of mapped ranges.

fn is_empty(&self) -> bool

Checks if the map is empty.

fn insert(&mut self, range: Range<T>, value: V)

Adds a new mapping from a range of characters to value.

fn from_vec(vec: Vec<(Range<T>, V)>) -> RangeMultiMap<T, V>

Creates a map from a vector of pairs.

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

Returns a new RangeMultiMap containing only the mappings for keys that belong to the given set.

fn map_values<F>(&mut self, f: F) where F: FnMut(&V) -> V

fn retain_values<F>(&mut self, f: F) where F: FnMut(&V) -> bool

Modifies this map in place to only contain mappings whose values v satisfy f(v).

fn into_vec(self) -> Vec<(Range<T>, V)>

Returns the underlying Vec.

fn ranges_values<'a>(&'a self) -> Iter<'a, (Range<T>, V)>

Iterates over all the mapped ranges and values.

impl<T: Debug + PrimInt, V: Clone + Debug + Ord> RangeMultiMap<T, V>

fn group(&self) -> RangeMap<T, Vec<V>>

Makes the ranges sorted and non-overlapping. The data associated with each range will be a sorted Vec<T> instead of a single T.

Trait Implementations

impl<T: PartialEq, V: PartialEq> PartialEq for RangeMultiMap<T, V>

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

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

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

This method tests for !=.

impl<T: Hash, V: Hash> Hash for RangeMultiMap<T, V>

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

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, V: Eq> Eq for RangeMultiMap<T, V>

impl<T: Clone, V: Clone> Clone for RangeMultiMap<T, V>

fn clone(&self) -> RangeMultiMap<T, V>

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, V: Clone + Debug + PartialEq> Debug for RangeMultiMap<T, V>

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

Formats the value using the given formatter.