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: Int) -> IntBig
pub const fn from_candid(value: Int) -> IntBig
Construct from the canonical Candid signed-integer representation.
Sourcepub fn from_bigint(value: BigInt) -> IntBig
pub fn from_bigint(value: BigInt) -> IntBig
Construct from a num_bigint signed integer.
Sourcepub fn sign_and_u32_digits(
&self,
) -> (bool, impl DoubleEndedIterator + ExactSizeIterator)
pub fn sign_and_u32_digits( &self, ) -> (bool, impl DoubleEndedIterator + 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: IntBig) -> IntBig
pub fn saturating_add(self, rhs: IntBig) -> IntBig
Saturating addition (unbounded; equivalent to normal addition).
Sourcepub fn saturating_sub(self, rhs: IntBig) -> IntBig
pub fn saturating_sub(self, rhs: IntBig) -> IntBig
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: IntBig)
fn add_assign(&mut self, __rhs: IntBig)
+= 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: D,
) -> Result<IntBig, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<IntBig, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Source§impl DivAssign for IntBig
impl DivAssign for IntBig
Source§fn div_assign(&mut self, other: IntBig)
fn div_assign(&mut self, other: IntBig)
/= operation. Read moreimpl Eq for IntBig
Source§impl MulAssign for IntBig
impl MulAssign for IntBig
Source§fn mul_assign(&mut self, other: IntBig)
fn mul_assign(&mut self, other: IntBig)
*= operation. Read moreSource§impl NormalizeAuto for IntBig
impl NormalizeAuto for IntBig
fn normalize_self(&mut self, _ctx: &mut dyn VisitorContext)
Source§impl NormalizeCustom for IntBig
impl NormalizeCustom for IntBig
fn normalize_custom(&mut self, _ctx: &mut dyn VisitorContext)
Source§impl NumericValue for IntBig
impl NumericValue for IntBig
Source§impl Ord for IntBig
impl Ord for IntBig
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for IntBig
impl PartialOrd for IntBig
Source§impl Serialize for IntBig
impl Serialize for IntBig
Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
impl StructuralPartialEq for IntBig
Source§impl SubAssign for IntBig
impl SubAssign for IntBig
Source§fn sub_assign(&mut self, __rhs: IntBig)
fn sub_assign(&mut self, __rhs: IntBig)
-= operation. Read moreSource§impl ValidateAuto for IntBig
impl ValidateAuto for IntBig
fn validate_self(&self, _ctx: &mut dyn VisitorContext)
Source§impl ValidateCustom for IntBig
impl ValidateCustom for IntBig
fn validate_custom(&self, _ctx: &mut dyn VisitorContext)
Auto Trait Implementations§
impl Freeze for IntBig
impl RefUnwindSafe for IntBig
impl Send for IntBig
impl Sync for IntBig
impl Unpin for IntBig
impl UnsafeUnpin for IntBig
impl UnwindSafe for IntBig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<T> CustomError for T
impl<T> CustomError for T
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.