Struct rangemap::RangeMap[][src]

pub struct RangeMap<K, V> { /* fields omitted */ }
Expand description

A map whose keys are stored as (half-open) ranges bounded inclusively below and exclusively above (start..end).

Contiguous and overlapping ranges that map to the same value are coalesced into a single range.

Implementations

Makes a new empty RangeMap.

Returns a reference to the value corresponding to the given key, if the key is covered by any range in the map.

Returns the range-value pair (as a pair of references) corresponding to the given key, if the key is covered by any range in the map.

Returns true if any range in the map covers the specified key.

Gets an iterator over all pairs of key range and value, ordered by key range.

The iterator element type is (&'a Range<K>, &'a V).

Insert a pair of key range and value into the map.

If the inserted range partially or completely overlaps any existing range in the map, then the existing range (or ranges) will be partially or completely replaced by the inserted range.

If the inserted range either overlaps or is immediately adjacent any existing range mapping to the same value, then the ranges will be coalesced into a single contiguous range.

Panics

Panics if range start >= end.

Removes a range from the map, if all or any of it was present.

If the range to be removed partially overlaps any ranges in the map, then those ranges will be contracted to no longer cover the removed range.

Panics

Panics if range start >= end.

Gets an iterator over all the maximally-sized ranges contained in outer_range that are not covered by any range stored in the map.

The iterator element type is Range<K>.

NOTE: Calling gaps eagerly finds the first gap, even if the iterator is never consumed.

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

Returns the “default value” for a type. Read more

Extends a collection with the contents of an iterator. Read more

🔬 This is a nightly-only experimental API. (extend_one)

Extends a collection with exactly one element.

🔬 This is a nightly-only experimental API. (extend_one)

Reserves capacity in a collection for the given number of additional elements. Read more

Creates a value from an iterator. Read more

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. 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

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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.