pub(crate) enum MaybeInfiniteInt {
NegInfinity,
Finite(u128),
JustAfterMax,
PosInfinity,
}Expand description
A possibly infinite integer. Values are encoded such that the ordering on u128 matches the
natural order on the original type. For example, -128i8 is encoded as 0 and 127i8 as
255. See signed_bias for details.
Variants§
NegInfinity
Finite(u128)
Encoded value. DO NOT CONSTRUCT BY HAND; use new_finite.
JustAfterMax
The integer after u128::MAX. We need it to represent x..=u128::MAX as an exclusive range.
PosInfinity
Implementations§
source§impl MaybeInfiniteInt
impl MaybeInfiniteInt
fn signed_bias(tcx: TyCtxt<'_>, ty: Ty<'_>) -> u128
fn new_finite(tcx: TyCtxt<'_>, ty: Ty<'_>, bits: u128) -> Self
fn from_pat_range_bdy<'tcx>( bdy: PatRangeBoundary<'tcx>, ty: Ty<'tcx>, tcx: TyCtxt<'tcx>, param_env: ParamEnv<'tcx> ) -> Self
sourcefn to_diagnostic_pat_range_bdy<'tcx>(
self,
ty: Ty<'tcx>,
tcx: TyCtxt<'tcx>
) -> PatRangeBoundary<'tcx>
fn to_diagnostic_pat_range_bdy<'tcx>( self, ty: Ty<'tcx>, tcx: TyCtxt<'tcx> ) -> PatRangeBoundary<'tcx>
Used only for diagnostics.
Note: it is possible to get isize/usize::MAX+1 here, as explained in the doc for
IntRange::split. This cannot be represented as a Const, so we represent it with
PosInfinity.
Trait Implementations§
source§impl Clone for MaybeInfiniteInt
impl Clone for MaybeInfiniteInt
source§fn clone(&self) -> MaybeInfiniteInt
fn clone(&self) -> MaybeInfiniteInt
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for MaybeInfiniteInt
impl Debug for MaybeInfiniteInt
source§impl Ord for MaybeInfiniteInt
impl Ord for MaybeInfiniteInt
source§fn cmp(&self, other: &MaybeInfiniteInt) -> Ordering
fn cmp(&self, other: &MaybeInfiniteInt) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq for MaybeInfiniteInt
impl PartialEq for MaybeInfiniteInt
source§fn eq(&self, other: &MaybeInfiniteInt) -> bool
fn eq(&self, other: &MaybeInfiniteInt) -> bool
self and other values to be equal, and is used
by ==.source§impl PartialOrd for MaybeInfiniteInt
impl PartialOrd for MaybeInfiniteInt
source§fn partial_cmp(&self, other: &MaybeInfiniteInt) -> Option<Ordering>
fn partial_cmp(&self, other: &MaybeInfiniteInt) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read moreimpl Copy for MaybeInfiniteInt
impl Eq for MaybeInfiniteInt
impl StructuralEq for MaybeInfiniteInt
impl StructuralPartialEq for MaybeInfiniteInt
Auto Trait Implementations§
impl RefUnwindSafe for MaybeInfiniteInt
impl Send for MaybeInfiniteInt
impl Sync for MaybeInfiniteInt
impl Unpin for MaybeInfiniteInt
impl UnwindSafe for MaybeInfiniteInt
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
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 24 bytes
Size for each variant:
NegInfinity: 0 bytesFinite: 16 bytesJustAfterMax: 0 bytesPosInfinity: 0 bytes