Crate more_ranges

Crate more_ranges 

Source
Expand description

Range types that are not included in the standard library.

Specifically, these are ranges which are bounded exclusively below.

These ranges currently do not function as Iterators and cannot be used in indexing.

§Example

While each range type in the standard library is either bounded inclusively below or unbounded below, each range type provided in this crate is bounded exclusively below. Compare, for example, RangeFrom with RangeFromExclusive.

use std::ops::{Bound, RangeBounds, RangeFrom};
use more_ranges::RangeFromExclusive;

let range_inclusive = RangeFrom {
    start: 1,
};
let range_exclusive = RangeFromExclusive {
    start: 1,
};

// The inclusive range is inclusively bound.
assert_eq!(range_inclusive.start_bound(), Bound::Included(&1));

// Contrastingly, the exclusive range is exclusively bound.
assert_eq!(range_exclusive.start_bound(), Bound::Excluded(&1));

Structs§

RangeFromExclusive
A range only bounded exclusively below.
RangeFromExclusiveToExclusive
A range bounded exclusively below and above.
RangeFromExclusiveToInclusive
A range bounded exclusively below and inclusively above.