pub struct Saturating<T>(pub T);Expand description
Natural numbers with saturating arithmetic
In contrast to std::num::Saturating, T::MAX represents an
out-of-bounds value, and a subsequent subtraction or right shift does not
change this value.
Tuple Fields§
§0: TTrait Implementations§
source§impl<'a> AddAssign<&'a Saturating<u128>> for Saturating<u128>
impl<'a> AddAssign<&'a Saturating<u128>> for Saturating<u128>
source§fn add_assign(&mut self, rhs: &'a Self)
fn add_assign(&mut self, rhs: &'a Self)
Performs the
+= operation. Read moresource§impl<'a> AddAssign<&'a Saturating<u64>> for Saturating<u64>
impl<'a> AddAssign<&'a Saturating<u64>> for Saturating<u64>
source§fn add_assign(&mut self, rhs: &'a Self)
fn add_assign(&mut self, rhs: &'a Self)
Performs the
+= operation. Read moresource§impl<T: Clone> Clone for Saturating<T>
impl<T: Clone> Clone for Saturating<T>
source§fn clone(&self) -> Saturating<T>
fn clone(&self) -> Saturating<T>
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<T: Hash> Hash for Saturating<T>
impl<T: Hash> Hash for Saturating<T>
source§impl<T> IsFloatingPoint for Saturating<T>
impl<T> IsFloatingPoint for Saturating<T>
cbindgen:ignore
source§const FLOATING_POINT: bool = false
const FLOATING_POINT: bool = false
true iff the underlying type is a floating point numbersource§const MIN_EXP: i32 = 0i32
const MIN_EXP: i32 = 0i32
One greater than the minimum possible normal power of 2 exponent, see
f64::MIN_EXP for instance. 0 for integerssource§impl<T: Ord> Ord for Saturating<T>
impl<T: Ord> Ord for Saturating<T>
source§fn cmp(&self, other: &Saturating<T>) -> Ordering
fn cmp(&self, other: &Saturating<T>) -> 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<T: PartialEq> PartialEq for Saturating<T>
impl<T: PartialEq> PartialEq for Saturating<T>
source§impl<T: PartialOrd> PartialOrd for Saturating<T>
impl<T: PartialOrd> PartialOrd for Saturating<T>
source§impl ShlAssign<u32> for Saturating<u128>
impl ShlAssign<u32> for Saturating<u128>
source§fn shl_assign(&mut self, rhs: u32)
fn shl_assign(&mut self, rhs: u32)
Performs the
<<= operation. Read moresource§impl ShlAssign<u32> for Saturating<u64>
impl ShlAssign<u32> for Saturating<u64>
source§fn shl_assign(&mut self, rhs: u32)
fn shl_assign(&mut self, rhs: u32)
Performs the
<<= operation. Read moresource§impl ShrAssign<u32> for Saturating<u128>
impl ShrAssign<u32> for Saturating<u128>
source§fn shr_assign(&mut self, rhs: u32)
fn shr_assign(&mut self, rhs: u32)
Performs the
>>= operation. Read moresource§impl ShrAssign<u32> for Saturating<u64>
impl ShrAssign<u32> for Saturating<u64>
source§fn shr_assign(&mut self, rhs: u32)
fn shr_assign(&mut self, rhs: u32)
Performs the
>>= operation. Read moresource§impl<'a> SubAssign<&'a Saturating<u128>> for Saturating<u128>
impl<'a> SubAssign<&'a Saturating<u128>> for Saturating<u128>
source§fn sub_assign(&mut self, rhs: &'a Self)
fn sub_assign(&mut self, rhs: &'a Self)
Performs the
-= operation. Read moresource§impl<'a> SubAssign<&'a Saturating<u64>> for Saturating<u64>
impl<'a> SubAssign<&'a Saturating<u64>> for Saturating<u64>
source§fn sub_assign(&mut self, rhs: &'a Self)
fn sub_assign(&mut self, rhs: &'a Self)
Performs the
-= operation. Read moreimpl<T: Copy> Copy for Saturating<T>
impl<T: Eq> Eq for Saturating<T>
impl<T> StructuralPartialEq for Saturating<T>
Auto Trait Implementations§
impl<T> Freeze for Saturating<T>where
T: Freeze,
impl<T> RefUnwindSafe for Saturating<T>where
T: RefUnwindSafe,
impl<T> Send for Saturating<T>where
T: Send,
impl<T> Sync for Saturating<T>where
T: Sync,
impl<T> Unpin for Saturating<T>where
T: Unpin,
impl<T> UnwindSafe for Saturating<T>where
T: 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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)