pub struct VarUint56(/* private fields */);Expand description
Variable-length 56-bit integer.
Stored as 3 bits of len (0..=7), followed by len bytes.
Implementations§
Source§impl VarUint56
impl VarUint56
Sourcepub const fn into_inner(self) -> u64
pub const fn into_inner(self) -> u64
Converts integer into an underlying primitive integer.
Sourcepub const fn is_valid(&self) -> bool
pub const fn is_valid(&self) -> bool
Returns true if an underlying primitive integer fits into the repr.
Sourcepub const fn bit_len(&self) -> Option<u16>
pub const fn bit_len(&self) -> Option<u16>
Returns number of data bits that this struct occupies.
Returns None if an underlying primitive integer is too large.
Sourcepub const fn unwrap_bit_len(&self) -> u16
pub const fn unwrap_bit_len(&self) -> u16
Returns number of data bits that this struct occupies.
Returns MAX_BITS if an underlying primitive integer is too large.
Sourcepub const fn saturating_add(self, rhs: Self) -> Self
pub const fn saturating_add(self, rhs: Self) -> Self
Saturating integer addition. Computes self + rhs,
saturating at the numeric bounds instead of overflowing.
Sourcepub const fn saturating_sub(self, rhs: Self) -> Self
pub const fn saturating_sub(self, rhs: Self) -> Self
Saturating integer addition. Computes self - rhs,
saturating at the numeric bounds instead of overflowing.
Sourcepub const fn saturating_mul(self, rhs: Self) -> Self
pub const fn saturating_mul(self, rhs: Self) -> Self
Saturating integer multiplication. Computes self * rhs,
returning None if overflow occurred.
Sourcepub const fn checked_add(self, rhs: Self) -> Option<Self>
pub const fn checked_add(self, rhs: Self) -> Option<Self>
Checked integer addition. Computes self + rhs, returning None if overflow occurred.
Sourcepub const fn checked_sub(self, rhs: Self) -> Option<Self>
pub const fn checked_sub(self, rhs: Self) -> Option<Self>
Checked integer subtraction. Computes self - rhs, returning None if overflow occurred.
Sourcepub const fn checked_mul(self, rhs: Self) -> Option<Self>
pub const fn checked_mul(self, rhs: Self) -> Option<Self>
Checked integer multiplication. Computes self * rhs, returning None if overflow occurred.
Sourcepub const fn checked_div(self, rhs: Self) -> Option<Self>
pub const fn checked_div(self, rhs: Self) -> Option<Self>
Checked integer division. Computes self / rhs, returning None if rhs == 0
or overflow occurred.
Sourcepub fn try_add_assign(&mut self, other: Self) -> Result<(), Error>
pub fn try_add_assign(&mut self, other: Self) -> Result<(), Error>
Tries to add an other value to the current one.
Sourcepub fn try_sub_assign(&mut self, other: Self) -> Result<(), Error>
pub fn try_sub_assign(&mut self, other: Self) -> Result<(), Error>
Tries to subtract an other value from the current one.
Sourcepub fn try_mul_assign(&mut self, other: Self) -> Result<(), Error>
pub fn try_mul_assign(&mut self, other: Self) -> Result<(), Error>
Tries to multiply the current value by the other value.
Sourcepub fn try_div_assign(&mut self, other: Self) -> Result<(), Error>
pub fn try_div_assign(&mut self, other: Self) -> Result<(), Error>
Tries to divice the current value by the other value.
Trait Implementations§
Source§impl AddAssign<u64> for VarUint56
impl AddAssign<u64> for VarUint56
Source§fn add_assign(&mut self, rhs: u64)
fn add_assign(&mut self, rhs: u64)
+= operation. Read moreSource§impl AddAssign for VarUint56
impl AddAssign for VarUint56
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
+= operation. Read moreSource§impl<'de> Deserialize<'de> for VarUint56
impl<'de> Deserialize<'de> for VarUint56
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>,
Source§impl DivAssign<u64> for VarUint56
impl DivAssign<u64> for VarUint56
Source§fn div_assign(&mut self, rhs: u64)
fn div_assign(&mut self, rhs: u64)
/= operation. Read moreSource§impl DivAssign for VarUint56
impl DivAssign for VarUint56
Source§fn div_assign(&mut self, rhs: Self)
fn div_assign(&mut self, rhs: Self)
/= operation. Read moreSource§impl ExactSize for VarUint56
impl ExactSize for VarUint56
Source§fn exact_size(&self) -> Size
fn exact_size(&self) -> Size
Source§impl MulAssign<u64> for VarUint56
impl MulAssign<u64> for VarUint56
Source§fn mul_assign(&mut self, rhs: u64)
fn mul_assign(&mut self, rhs: u64)
*= operation. Read moreSource§impl MulAssign for VarUint56
impl MulAssign for VarUint56
Source§fn mul_assign(&mut self, rhs: Self)
fn mul_assign(&mut self, rhs: Self)
*= operation. Read moreSource§impl Ord for VarUint56
impl Ord for VarUint56
Source§impl PartialOrd for VarUint56
impl PartialOrd for VarUint56
Source§impl ShlAssign<u8> for VarUint56
impl ShlAssign<u8> for VarUint56
Source§fn shl_assign(&mut self, rhs: u8)
fn shl_assign(&mut self, rhs: u8)
<<= operation. Read moreSource§impl ShrAssign<u8> for VarUint56
impl ShrAssign<u8> for VarUint56
Source§fn shr_assign(&mut self, rhs: u8)
fn shr_assign(&mut self, rhs: u8)
>>= operation. Read moreSource§impl Store for VarUint56
impl Store for VarUint56
Source§fn store_into(
&self,
builder: &mut CellBuilder,
_: &dyn CellContext,
) -> Result<(), Error>
fn store_into( &self, builder: &mut CellBuilder, _: &dyn CellContext, ) -> Result<(), Error>
Source§impl SubAssign<u64> for VarUint56
impl SubAssign<u64> for VarUint56
Source§fn sub_assign(&mut self, rhs: u64)
fn sub_assign(&mut self, rhs: u64)
-= operation. Read moreSource§impl SubAssign for VarUint56
impl SubAssign for VarUint56
Source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
-= operation. Read moreSource§impl WithAbiType for VarUint56
impl WithAbiType for VarUint56
impl Copy for VarUint56
impl Eq for VarUint56
impl StructuralPartialEq for VarUint56
Auto Trait Implementations§
impl Freeze for VarUint56
impl RefUnwindSafe for VarUint56
impl Send for VarUint56
impl Sync for VarUint56
impl Unpin for VarUint56
impl UnwindSafe for VarUint56
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<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
self to key and returns true if they are equal.