pub enum MaybeInfiniteInt {
NegInfinity,
Finite(u128),
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_{int,uint}
.
PosInfinity
Implementations§
Source§impl MaybeInfiniteInt
impl MaybeInfiniteInt
pub fn new_finite_uint(bits: u128) -> Self
pub fn new_finite_int(bits: u128, size: u64) -> Self
pub fn as_finite_uint(self) -> Option<u128>
pub fn as_finite_int(self, size: u64) -> Option<u128>
Trait Implementations§
Source§impl Clone for MaybeInfiniteInt
impl Clone for MaybeInfiniteInt
Source§fn clone(&self) -> MaybeInfiniteInt
fn clone(&self) -> MaybeInfiniteInt
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
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,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for MaybeInfiniteInt
impl PartialEq for MaybeInfiniteInt
Source§impl PartialOrd for MaybeInfiniteInt
impl PartialOrd for MaybeInfiniteInt
impl Copy for MaybeInfiniteInt
impl Eq for MaybeInfiniteInt
impl StructuralPartialEq for MaybeInfiniteInt
Auto Trait Implementations§
impl Freeze for MaybeInfiniteInt
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
Mutably borrows from an owned value. Read more