pub trait ToIntervalSet<Bound>where
Bound: Width,{
// Required method
fn to_interval_set(self) -> IntervalSet<Bound>;
}Required Methods§
Sourcefn to_interval_set(self) -> IntervalSet<Bound>
fn to_interval_set(self) -> IntervalSet<Bound>
Converts a value to an interval set. For example,
assert_eq!((3, 4).to_interval_set(), IntervalSet::new(3, 4));
assert_eq!([(2, 5), (7, 8)].to_interval_set(), IntervalSet::union(&IntervalSet::new(2, 5), &IntervalSet::new(7, 8)));Implementations on Foreign Types§
Source§impl<Bound> ToIntervalSet<Bound> for &[(Bound, Bound)]
impl<Bound> ToIntervalSet<Bound> for &[(Bound, Bound)]
Source§fn to_interval_set(self) -> IntervalSet<Bound>
fn to_interval_set(self) -> IntervalSet<Bound>
Converts an array to an interval set.
assert_eq!([(2, 5)].to_interval_set().interval_count(), 1);
assert_eq!([(1, 5), (11, 20)].to_interval_set().interval_count(), 2);
assert!(<&[(usize, usize)]>::default().to_interval_set().is_empty());Source§impl<Bound> ToIntervalSet<Bound> for Vec<(Bound, Bound)>
impl<Bound> ToIntervalSet<Bound> for Vec<(Bound, Bound)>
Source§fn to_interval_set(self) -> IntervalSet<Bound>
fn to_interval_set(self) -> IntervalSet<Bound>
Converts a vector of intervals to an interval set.
assert_eq!(vec![(2, 5)].to_interval_set().interval_count(), 1);
assert_eq!(vec![(1, 5), (11, 20)].to_interval_set().interval_count(), 2);
assert!(Vec::<(usize, usize)>::new().to_interval_set().is_empty());Source§impl<Bound, const N: usize> ToIntervalSet<Bound> for [(Bound, Bound); N]
impl<Bound, const N: usize> ToIntervalSet<Bound> for [(Bound, Bound); N]
Source§fn to_interval_set(self) -> IntervalSet<Bound>
fn to_interval_set(self) -> IntervalSet<Bound>
Converts a fixed-length array to an interval set.
assert_eq!([(2, 5)].to_interval_set().interval_count(), 1);
assert_eq!([(1, 5), (11, 20)].to_interval_set().interval_count(), 2);
assert!(([] as [(usize, usize); 0]).to_interval_set().is_empty());Source§impl<Bound: Width + Num> ToIntervalSet<Bound> for (Bound, Bound)
impl<Bound: Width + Num> ToIntervalSet<Bound> for (Bound, Bound)
Source§fn to_interval_set(self) -> IntervalSet<Bound>
fn to_interval_set(self) -> IntervalSet<Bound>
Converts a tuple to an interval set using the first element as the lower bound and second element as the upper bound.
assert_eq!((2, 6).to_interval_set(), IntervalSet::new(2, 6));The first and second elements need the same type.
ⓘ
let _ = (8 as u8, 9 as i8).to_interval_set(); // doesn't compile