pub enum ContinuousRange<Idx> {
Empty,
Single(Idx),
Inclusive(Idx, Idx),
Exclusive(Idx, Idx),
StartExclusive(Idx, Idx),
EndExclusive(Idx, Idx),
From(Idx),
FromExclusive(Idx),
To(Idx),
ToExclusive(Idx),
Full,
}
Variants§
Empty
A range containing no value
[]
Single(Idx)
A range containing a single value
value
Inclusive(Idx, Idx)
A range between start
(inclusive) and end
(inclusive)
[start..end]
Exclusive(Idx, Idx)
A range between start
(exclusive) and end
(exclusive)
(start..end)
StartExclusive(Idx, Idx)
A range between start
(exclusive) and end
(inclusive)
(start..end]
EndExclusive(Idx, Idx)
A range between start
(inclusive) and end
(exclusive)
[start..end)
From(Idx)
A range starting from start
(inclusive)
[start..)
FromExclusive(Idx)
A range starting from start
(exclusive)
(start..)
To(Idx)
A range ending with end
(inclusive)
(..end]
ToExclusive(Idx)
A range ending with end
(exclusive)
(..end)
Full
A range containing all values
Implementations§
Source§impl<Idx: PartialOrd + Clone> ContinuousRange<Idx>
impl<Idx: PartialOrd + Clone> ContinuousRange<Idx>
Sourcepub fn empty() -> ContinuousRange<Idx>
pub fn empty() -> ContinuousRange<Idx>
A range containing no value
[]
Sourcepub fn single(value: Idx) -> ContinuousRange<Idx>
pub fn single(value: Idx) -> ContinuousRange<Idx>
A range containing a single value
value
Sourcepub fn inclusive(start: Idx, end: Idx) -> ContinuousRange<Idx>where
Idx: PartialOrd,
pub fn inclusive(start: Idx, end: Idx) -> ContinuousRange<Idx>where
Idx: PartialOrd,
A range between start
(inclusive) and end
(inclusive)
[start..end]
Sourcepub fn exclusive(start: Idx, end: Idx) -> ContinuousRange<Idx>where
Idx: PartialOrd,
pub fn exclusive(start: Idx, end: Idx) -> ContinuousRange<Idx>where
Idx: PartialOrd,
A range between start
(exclusive) and end
(exclusive)
(start..end)
Sourcepub fn start_exclusive(start: Idx, end: Idx) -> ContinuousRange<Idx>where
Idx: PartialOrd,
pub fn start_exclusive(start: Idx, end: Idx) -> ContinuousRange<Idx>where
Idx: PartialOrd,
A range between start
(exclusive) and end
(inclusive)
(start..end]
Sourcepub fn end_exclusive(start: Idx, end: Idx) -> ContinuousRange<Idx>where
Idx: PartialOrd,
pub fn end_exclusive(start: Idx, end: Idx) -> ContinuousRange<Idx>where
Idx: PartialOrd,
A range between start
(inclusive) and end
(exclusive)
[start..end)
Sourcepub fn from(start: Idx) -> ContinuousRange<Idx>
pub fn from(start: Idx) -> ContinuousRange<Idx>
A range starting from start
(inclusive)
[start..)
Sourcepub fn from_exclusive(start: Idx) -> ContinuousRange<Idx>
pub fn from_exclusive(start: Idx) -> ContinuousRange<Idx>
A range starting from start
(exclusive)
(start..)
Sourcepub fn to(end: Idx) -> ContinuousRange<Idx>
pub fn to(end: Idx) -> ContinuousRange<Idx>
A range ending with end
(inclusive)
(..end]
Sourcepub fn to_exclusive(end: Idx) -> ContinuousRange<Idx>
pub fn to_exclusive(end: Idx) -> ContinuousRange<Idx>
A range ending with end
(exclusive)
(..end)
Sourcepub fn full() -> ContinuousRange<Idx>
pub fn full() -> ContinuousRange<Idx>
A range containing all values
Sourcepub fn from_bounds(bounds: (Bound<&Idx>, Bound<&Idx>)) -> Self
pub fn from_bounds(bounds: (Bound<&Idx>, Bound<&Idx>)) -> Self
Create a new range from the specified bounds
Sourcepub fn range_bounds(&self) -> Option<(Bound<&Idx>, Bound<&Idx>)>
pub fn range_bounds(&self) -> Option<(Bound<&Idx>, Bound<&Idx>)>
Get the bounds of the range or None if empty
pub fn start(&self) -> Option<Bound<&Idx>>
pub fn end(&self) -> Option<Bound<&Idx>>
Sourcepub fn contains(&self, value: impl Borrow<Idx>) -> boolwhere
Idx: PartialOrd + PartialEq,
pub fn contains(&self, value: impl Borrow<Idx>) -> boolwhere
Idx: PartialOrd + PartialEq,
Check if the range contains the provide value
pub fn contains_range(&self, other: &ContinuousRange<Idx>) -> boolwhere
Idx: Debug,
pub fn disjoint_from_range(&self, other: &ContinuousRange<Idx>) -> boolwhere
Idx: Debug,
pub fn union(
&self,
other: &ContinuousRange<Idx>,
) -> Option<ContinuousRange<Idx>>where
Idx: PartialOrd + Debug,
pub fn intersection(&self, other: &ContinuousRange<Idx>) -> ContinuousRange<Idx>where
Idx: PartialOrd + Debug,
pub fn difference(
&self,
other: &ContinuousRange<Idx>,
) -> Option<ContinuousRange<Idx>>where
Idx: PartialOrd + Debug,
pub fn intersects(&self, other: &ContinuousRange<Idx>) -> boolwhere
Idx: Debug,
Sourcepub fn compare(&self, other: &ContinuousRange<Idx>) -> Option<RangesRelation>where
Idx: Debug,
pub fn compare(&self, other: &ContinuousRange<Idx>) -> Option<RangesRelation>where
Idx: Debug,
Compare the bounds of two ranges. Returns Option::None
if an empty range is
compared to a non-empty range.
§Panics
This function may panic if the PartialOrd
contract isn’t respected.
pub fn simplify_mut(&mut self)where
Idx: PartialOrd,
pub fn simplify(&self) -> Selfwhere
Idx: PartialOrd,
pub fn is_empty(&self) -> bool
pub fn is_full(&self) -> bool
Trait Implementations§
Source§impl<Idx: Clone> Clone for ContinuousRange<Idx>
impl<Idx: Clone> Clone for ContinuousRange<Idx>
Source§fn clone(&self) -> ContinuousRange<Idx>
fn clone(&self) -> ContinuousRange<Idx>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more