pub struct VarUint24(/* private fields */);Expand description
Variable-length 24-bit integer.
Stored as 2 bits of len (0..=3), followed by len bytes.
Implementations§
Source§impl VarUint24
impl VarUint24
Sourcepub const fn into_inner(self) -> u32
pub const fn into_inner(self) -> u32
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<u32> for VarUint24
impl AddAssign<u32> for VarUint24
Source§fn add_assign(&mut self, rhs: u32)
fn add_assign(&mut self, rhs: u32)
+= operation. Read moreSource§impl AddAssign for VarUint24
impl AddAssign for VarUint24
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
+= operation. Read moreSource§impl<'de> Deserialize<'de> for VarUint24
impl<'de> Deserialize<'de> for VarUint24
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<u32> for VarUint24
impl DivAssign<u32> for VarUint24
Source§fn div_assign(&mut self, rhs: u32)
fn div_assign(&mut self, rhs: u32)
/= operation. Read moreSource§impl DivAssign for VarUint24
impl DivAssign for VarUint24
Source§fn div_assign(&mut self, rhs: Self)
fn div_assign(&mut self, rhs: Self)
/= operation. Read moreSource§impl ExactSize for VarUint24
impl ExactSize for VarUint24
Source§fn exact_size(&self) -> Size
fn exact_size(&self) -> Size
Source§impl MulAssign<u32> for VarUint24
impl MulAssign<u32> for VarUint24
Source§fn mul_assign(&mut self, rhs: u32)
fn mul_assign(&mut self, rhs: u32)
*= operation. Read moreSource§impl MulAssign for VarUint24
impl MulAssign for VarUint24
Source§fn mul_assign(&mut self, rhs: Self)
fn mul_assign(&mut self, rhs: Self)
*= operation. Read moreSource§impl Ord for VarUint24
impl Ord for VarUint24
Source§impl PartialOrd for VarUint24
impl PartialOrd for VarUint24
Source§impl ShlAssign<u8> for VarUint24
impl ShlAssign<u8> for VarUint24
Source§fn shl_assign(&mut self, rhs: u8)
fn shl_assign(&mut self, rhs: u8)
<<= operation. Read moreSource§impl ShrAssign<u8> for VarUint24
impl ShrAssign<u8> for VarUint24
Source§fn shr_assign(&mut self, rhs: u8)
fn shr_assign(&mut self, rhs: u8)
>>= operation. Read moreSource§impl Store for VarUint24
impl Store for VarUint24
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<u32> for VarUint24
impl SubAssign<u32> for VarUint24
Source§fn sub_assign(&mut self, rhs: u32)
fn sub_assign(&mut self, rhs: u32)
-= operation. Read moreSource§impl SubAssign for VarUint24
impl SubAssign for VarUint24
Source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
-= operation. Read moreSource§impl WithAbiType for VarUint24
impl WithAbiType for VarUint24
impl Copy for VarUint24
impl Eq for VarUint24
impl StructuralPartialEq for VarUint24
Auto Trait Implementations§
impl Freeze for VarUint24
impl RefUnwindSafe for VarUint24
impl Send for VarUint24
impl Sync for VarUint24
impl Unpin for VarUint24
impl UnwindSafe for VarUint24
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.