pub struct IntRange {
pub lo: MaybeInfiniteInt,
pub hi: MaybeInfiniteInt,
}
Expand description
An exclusive interval, used for precise integer exhaustiveness checking. IntRange
s always
store a contiguous range.
IntRange
is never used to encode an empty range or a “range” that wraps around the (offset)
space: i.e., range.lo < range.hi
.
Fields§
§lo: MaybeInfiniteInt
§hi: MaybeInfiniteInt
Implementations§
Source§impl IntRange
impl IntRange
Sourcepub fn is_singleton(&self) -> bool
pub fn is_singleton(&self) -> bool
Best effort; will not know that e.g. 255u8..
is a singleton.
Sourcepub fn from_singleton(x: MaybeInfiniteInt) -> IntRange
pub fn from_singleton(x: MaybeInfiniteInt) -> IntRange
Construct a singleton range.
x
must be a Finite(_)
value.
Sourcepub fn from_range(
lo: MaybeInfiniteInt,
hi: MaybeInfiniteInt,
end: RangeEnd,
) -> IntRange
pub fn from_range( lo: MaybeInfiniteInt, hi: MaybeInfiniteInt, end: RangeEnd, ) -> IntRange
Construct a range with these boundaries.
lo
must not be PosInfinity
. hi
must not be NegInfinity
.
Trait Implementations§
Source§impl Debug for IntRange
impl Debug for IntRange
Note: this will render signed ranges incorrectly. To render properly, convert to a pattern first.
impl Copy for IntRange
impl Eq for IntRange
impl StructuralPartialEq for IntRange
Auto Trait Implementations§
impl Freeze for IntRange
impl RefUnwindSafe for IntRange
impl Send for IntRange
impl Sync for IntRange
impl Unpin for IntRange
impl UnwindSafe for IntRange
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