pub enum RangeEnd<Idx> {
Inclusive(Idx),
Exclusive(Idx),
}Expand description
The upper bound of a Range, either inclusive or exclusive.
Ordering is by boundary position: bounds compare by their index first, and
on equal indices Exclusive(n) < Inclusive(n), since an inclusive bound
extends one element further. Inclusive(n) and Exclusive(n + 1) denote
the same boundary but compare as unequal, with Inclusive(n) ordered
first, consistent with Eq.
§Examples
use ps_range::RangeEnd;
assert!(RangeEnd::Exclusive(5) < RangeEnd::Inclusive(5));
assert!(RangeEnd::Inclusive(4) < RangeEnd::Exclusive(5));Variants§
Inclusive(Idx)
The end index is part of the range.
Exclusive(Idx)
The end index is not part of the range.
Trait Implementations§
impl<Idx: Copy> Copy for RangeEnd<Idx>
impl<Idx: Eq> Eq for RangeEnd<Idx>
Source§impl<Idx: Ord> Ord for RangeEnd<Idx>
impl<Idx: Ord> Ord for RangeEnd<Idx>
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<Idx: PartialOrd> PartialOrd for RangeEnd<Idx>
impl<Idx: PartialOrd> PartialOrd for RangeEnd<Idx>
impl<Idx: PartialEq> StructuralPartialEq for RangeEnd<Idx>
Auto Trait Implementations§
impl<Idx> Freeze for RangeEnd<Idx>where
Idx: Freeze,
impl<Idx> RefUnwindSafe for RangeEnd<Idx>where
Idx: RefUnwindSafe,
impl<Idx> Send for RangeEnd<Idx>where
Idx: Send,
impl<Idx> Sync for RangeEnd<Idx>where
Idx: Sync,
impl<Idx> Unpin for RangeEnd<Idx>where
Idx: Unpin,
impl<Idx> UnsafeUnpin for RangeEnd<Idx>where
Idx: UnsafeUnpin,
impl<Idx> UnwindSafe for RangeEnd<Idx>where
Idx: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more