pub struct NatBig(/* private fields */);Expand description
Arbitrary-precision unsigned integer used by schema and typed values.
Implementations§
Source§impl NatBig
impl NatBig
Sourcepub const fn from_candid(value: WrappedNat) -> Self
pub const fn from_candid(value: WrappedNat) -> Self
Construct from the canonical Candid natural-number representation.
Sourcepub fn from_biguint(value: BigUint) -> Self
pub fn from_biguint(value: BigUint) -> Self
Construct from a num_bigint unsigned integer.
Sourcepub fn u32_digits(&self) -> Vec<u32>
pub fn u32_digits(&self) -> Vec<u32>
Return base-2^32 limbs for decimal key encoding.
This allocates for the returned limb vector.
Sourcepub fn to_leb128(&self) -> Vec<u8> ⓘ
pub fn to_leb128(&self) -> Vec<u8> ⓘ
Serialize this arbitrary-precision natural for internal hash and sort-key framing.
Sourcepub fn saturating_add(self, rhs: Self) -> Self
pub fn saturating_add(self, rhs: Self) -> Self
Saturating addition (unbounded; equivalent to normal addition).
Sourcepub fn saturating_sub(self, rhs: Self) -> Self
pub fn saturating_sub(self, rhs: Self) -> Self
Saturating subtraction; clamps at zero on underflow.
Trait Implementations§
Source§impl AddAssign for NatBig
impl AddAssign for NatBig
Source§fn add_assign(&mut self, __rhs: Self)
fn add_assign(&mut self, __rhs: Self)
Performs the
+= operation. Read moreSource§impl CandidType for NatBig
impl CandidType for NatBig
Source§impl<'de> Deserialize<'de> for NatBig
impl<'de> Deserialize<'de> for NatBig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl DivAssign for NatBig
impl DivAssign for NatBig
Source§fn div_assign(&mut self, other: Self)
fn div_assign(&mut self, other: Self)
Performs the
/= operation. Read moreimpl Eq for NatBig
Source§impl MulAssign for NatBig
impl MulAssign for NatBig
Source§fn mul_assign(&mut self, other: Self)
fn mul_assign(&mut self, other: Self)
Performs the
*= operation. Read moreSource§impl NumericValue for NatBig
impl NumericValue for NatBig
Source§fn try_to_decimal(&self) -> Option<Decimal>
fn try_to_decimal(&self) -> Option<Decimal>
Convert this value into
Decimal for generic numeric handling.Source§fn try_from_decimal(value: Decimal) -> Option<Self>
fn try_from_decimal(value: Decimal) -> Option<Self>
Rebuild the value from
Decimal after generic numeric handling.Source§impl Ord for NatBig
impl Ord for NatBig
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 PartialOrd for NatBig
impl PartialOrd for NatBig
impl StructuralPartialEq for NatBig
Source§impl SubAssign for NatBig
impl SubAssign for NatBig
Source§fn sub_assign(&mut self, __rhs: Self)
fn sub_assign(&mut self, __rhs: Self)
Performs the
-= operation. Read moreAuto Trait Implementations§
impl Freeze for NatBig
impl RefUnwindSafe for NatBig
impl Send for NatBig
impl Sync for NatBig
impl Unpin for NatBig
impl UnsafeUnpin for NatBig
impl UnwindSafe for NatBig
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