Struct range_map::RangeMap

source ·
pub struct RangeMap<T, V> { /* private fields */ }
Expand description

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

Implementations

Creates a new empty RangeMap.

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

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

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

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

Panics

Panics if there are ranges that overlap and do not map to the same value. If you are not sure whether this could happen, use RangeMap::try_from_iter instead.

Feeds this value into the given Hasher. Read more
Feeds a slice of this type into the given Hasher. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.