Crate range_inclusive

source ·
Expand description

A RangeInclusive implementation that offers a separate iterator type.

This RangeInclusive does not directly implement the Iterator trait, allowing one to iterate over a copy of the range without mutating the original range. This is accomplished by requiring that the generic type Idx implements Clone; in the future we can remove this trait bound by using references, though most users of a range type typically do so with numeric types that are cheap to copy/clone.

All behavior except iteration matches that of std::ops::RangeInclusive. Due to the iterator behavior, there is no need to waste space tracking whether the range has been exhausted, meaning that this RangeInclusive is exactly the size of its two bounds.

Structs