Struct range_map::RangeMultiMap
source · pub struct RangeMultiMap<T, V> { /* private fields */ }
Expand description
A multi-valued mapping from primitive integers to other data.
Implementations
sourceimpl<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)where
F: FnMut(&V) -> V,
sourcepub fn retain_values<F>(&mut self, f: F)where
F: FnMut(&V) -> bool,
pub 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)
.
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
sourceimpl<T: Clone, V: Clone> Clone for RangeMultiMap<T, V>
impl<T: Clone, V: Clone> Clone for RangeMultiMap<T, V>
sourcefn clone(&self) -> RangeMultiMap<T, V>
fn clone(&self) -> RangeMultiMap<T, V>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl<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>
sourcefn 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..
sourceimpl<T: Hash, V: Hash> Hash for RangeMultiMap<T, V>
impl<T: Hash, V: Hash> Hash for RangeMultiMap<T, V>
sourceimpl<T: PartialEq, V: PartialEq> PartialEq<RangeMultiMap<T, V>> for RangeMultiMap<T, V>
impl<T: PartialEq, V: PartialEq> PartialEq<RangeMultiMap<T, V>> for RangeMultiMap<T, V>
sourcefn eq(&self, other: &RangeMultiMap<T, V>) -> bool
fn eq(&self, other: &RangeMultiMap<T, V>) -> bool
impl<T: Eq, V: Eq> Eq for RangeMultiMap<T, V>
impl<T, V> StructuralEq for RangeMultiMap<T, V>
impl<T, V> StructuralPartialEq for RangeMultiMap<T, V>
Auto Trait Implementations
impl<T, V> RefUnwindSafe for RangeMultiMap<T, V>where
T: RefUnwindSafe,
V: RefUnwindSafe,
impl<T, V> Send for RangeMultiMap<T, V>where
T: Send,
V: Send,
impl<T, V> Sync for RangeMultiMap<T, V>where
T: Sync,
V: Sync,
impl<T, V> Unpin for RangeMultiMap<T, V>where
T: Unpin,
V: Unpin,
impl<T, V> UnwindSafe for RangeMultiMap<T, V>where
T: UnwindSafe,
V: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more