Struct range_map::RangeMap [] [src]

pub struct RangeMap<T, V> { /* fields omitted */ }

A set of characters. Optionally, each character in the set may be associated with some data.

Methods

impl<T: Debug + PrimInt, V: Clone + Debug + Eq> RangeMap<T, V>
[src]

Creates a new empty RangeMap.

Creates a RangeMap from a Vec, which must contain ranges in ascending order. If any ranges overlap, they must map to the same value.

Panics if the ranges are not sorted, or if they overlap without mapping to the same value.

Returns the number of mapped ranges.

Note that this is not usually the same as the number of mapped values.

Tests whether this map is empty.

Tests whether this CharMap maps every value.

Iterates over all the mapped ranges and values.

Iterates over all mappings.

Finds the value that x maps to, if it exists.

Runs in O(log n) time, where n is the number of mapped ranges.

Returns those mappings whose keys belong to the given set.

Counts the number of mapped keys.

This saturates at usize::MAX.

Returns the set of mapped chars, forgetting what they are mapped to.

Modifies the values in place.

Modifies this map to contain only those mappings with values v satisfying f(v).

Returns a mutable view into this map.

The ranges should not be modified, since that might violate our invariants.

This method will eventually be removed, probably once anonymous return values allow is to write a values_mut() iterator more easily.

Trait Implementations

impl<T: Clone, V: Clone> Clone for RangeMap<T, V>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<T: Eq, V: Eq> Eq for RangeMap<T, V>
[src]

impl<T: Hash, V: Hash> Hash for RangeMap<T, V>
[src]

Feeds this value into the given [Hasher]. Read more

Feeds a slice of this type into the given [Hasher]. Read more

impl<T: PartialEq, V: PartialEq> PartialEq for RangeMap<T, V>
[src]

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

This method tests for !=.

impl<T: Debug, V: Debug> Debug for RangeMap<T, V>
[src]

Formats the value using the given formatter.

impl<T: Debug + PrimInt, V: Clone + Debug + Eq> FromIterator<(Range<T>, V)> for RangeMap<T, V>
[src]

Builds a RangeMap from an iterator over pairs. If any ranges overlap, they must map to the same value.

Panics

  • if there are ranges that overlap and do not map to the same value.