pub struct RangeMultiMap<T, V> { /* private fields */ }
Expand description
A multi-valued mapping from primitive integers to other data.
Implementations§
Source§impl<T: Debug + PrimInt, V: Clone + Debug + PartialEq> RangeMultiMap<T, V>
impl<T: Debug + PrimInt, V: Clone + Debug + PartialEq> RangeMultiMap<T, V>
Sourcepub fn new() -> RangeMultiMap<T, V>
pub fn new() -> RangeMultiMap<T, V>
Creates a new empty map.
Sourcepub fn num_ranges(&self) -> usize
pub fn num_ranges(&self) -> usize
Returns the number of mapped ranges.
Sourcepub fn insert(&mut self, range: Range<T>, value: V)
pub fn insert(&mut self, range: Range<T>, value: V)
Adds a new mapping from a range of characters to value
.
Sourcepub fn from_vec(vec: Vec<(Range<T>, V)>) -> RangeMultiMap<T, V>
pub fn from_vec(vec: Vec<(Range<T>, V)>) -> RangeMultiMap<T, V>
Creates a map from a vector of pairs.
Sourcepub fn intersection(&self, other: &RangeSet<T>) -> RangeMultiMap<T, V>
pub 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.
pub fn map_values<F>(&mut self, f: F)
Sourcepub fn retain_values<F>(&mut self, f: F)
pub fn retain_values<F>(&mut self, f: F)
Modifies this map in place to only contain mappings whose values v
satisfy f(v)
.
Sourcepub fn ranges_values<'a>(&'a self) -> Iter<'a, (Range<T>, V)>
pub fn ranges_values<'a>(&'a self) -> Iter<'a, (Range<T>, V)>
Iterates over all the mapped ranges and values.
Trait Implementations§
Source§impl<T: Clone, V: Clone> Clone for RangeMultiMap<T, V>
impl<T: Clone, V: Clone> Clone for RangeMultiMap<T, V>
Source§fn clone(&self) -> RangeMultiMap<T, V>
fn clone(&self) -> RangeMultiMap<T, V>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<T: Debug + PrimInt, V: Clone + Debug + PartialEq> FromIterator<(Range<T>, V)> for RangeMultiMap<T, V>
impl<T: Debug + PrimInt, V: Clone + Debug + PartialEq> FromIterator<(Range<T>, V)> for RangeMultiMap<T, V>
Source§fn from_iter<I: IntoIterator<Item = (Range<T>, V)>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = (Range<T>, V)>>(iter: I) -> Self
Builds a RangeMultiMap
from an iterator over Range
and values..
impl<T: Eq, V: Eq> Eq for RangeMultiMap<T, V>
impl<T, V> StructuralPartialEq for RangeMultiMap<T, V>
Auto Trait Implementations§
impl<T, V> Freeze for RangeMultiMap<T, V>
impl<T, V> RefUnwindSafe for RangeMultiMap<T, V>where
V: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, V> Send for RangeMultiMap<T, V>
impl<T, V> Sync for RangeMultiMap<T, V>
impl<T, V> Unpin for RangeMultiMap<T, V>
impl<T, V> UnwindSafe for RangeMultiMap<T, V>where
V: UnwindSafe,
T: UnwindSafe,
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