pub struct IntBig(/* private fields */);Expand description
Arbitrary-precision signed integer used by schema and typed values.
Candid uses its native integer type; human-readable Serde uses decimal text. Binary Serde uses native small integers and tagged little-endian wide bytes.
Implementations§
Source§impl IntBig
impl IntBig
Sourcepub fn magnitude_bits(&self) -> u64
pub fn magnitude_bits(&self) -> u64
Return the magnitude’s bit length without allocating an encoded copy.
Sourcepub fn leb128_len(&self) -> u64
pub fn leb128_len(&self) -> u64
Return the exact signed LEB128 byte length without allocating or encoding.
Sourcepub const fn from_candid(value: WrappedInt) -> Self
pub const fn from_candid(value: WrappedInt) -> Self
Construct from the canonical Candid signed-integer representation.
Sourcepub fn from_bigint(value: BigInt) -> Self
pub fn from_bigint(value: BigInt) -> Self
Construct from a num_bigint signed integer.
Sourcepub fn sign_and_u32_digits(
&self,
) -> (bool, impl DoubleEndedIterator<Item = u32> + ExactSizeIterator + '_)
pub fn sign_and_u32_digits( &self, ) -> (bool, impl DoubleEndedIterator<Item = u32> + ExactSizeIterator + '_)
Borrow sign and little-endian base-2^32 magnitude limbs without allocation.
Sourcepub fn to_leb128(&self) -> Vec<u8> ⓘ
pub fn to_leb128(&self) -> Vec<u8> ⓘ
Serialize this arbitrary-precision integer for internal hash and sort-key framing.
Sourcepub fn leb128_bytes(&self) -> impl Iterator<Item = u8> + '_
pub fn leb128_bytes(&self) -> impl Iterator<Item = u8> + '_
Iterate canonical signed LEB128 bytes with constant scratch and no allocation.
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 (unbounded; equivalent to normal subtraction).
Trait Implementations§
Source§impl AddAssign for IntBig
impl AddAssign for IntBig
Source§fn add_assign(&mut self, __rhs: Self)
fn add_assign(&mut self, __rhs: Self)
+= operation. Read moreSource§impl CandidType for IntBig
impl CandidType for IntBig
Source§impl<'de> Deserialize<'de> for IntBig
impl<'de> Deserialize<'de> for IntBig
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Source§impl DivAssign for IntBig
impl DivAssign for IntBig
Source§fn div_assign(&mut self, other: Self)
fn div_assign(&mut self, other: Self)
/= operation. Read moreimpl Eq for IntBig
Source§impl MulAssign for IntBig
impl MulAssign for IntBig
Source§fn mul_assign(&mut self, other: Self)
fn mul_assign(&mut self, other: Self)
*= operation. Read moreSource§impl NumericValue for IntBig
impl NumericValue for IntBig
Source§fn try_to_decimal(&self) -> Option<Decimal>
fn try_to_decimal(&self) -> Option<Decimal>
Decimal for generic numeric handling.Source§fn try_from_decimal(value: Decimal) -> Option<Self>
fn try_from_decimal(value: Decimal) -> Option<Self>
Decimal after generic numeric handling.