Struct VarUint248

Source
pub struct VarUint248(/* private fields */);
Expand description

Variable-length 248-bit integer.

Stored as 5 bits of len (0..=31), followed by len bytes.

Implementations§

Source§

impl VarUint248

Source

pub const ZERO: Self

The additive identity for this integer type, i.e. 0.

Source

pub const ONE: Self

The multiplicative identity for this integer type, i.e. 1.

Source

pub const MIN: Self

The smallest value that can be represented by this integer type.

Source

pub const MAX: Self

The largest value that can be represented by this integer type.

Source

pub const LEN_BITS: u16 = 5u16

The number of data bits that the length occupies.

Source

pub const MAX_BITS: u16 = 253u16

The maximum number of data bits that this struct occupies.

Source

pub const fn new(value: u128) -> Self

Creates a new integer value from a primitive integer.

Source

pub const fn from_words(hi: u128, lo: u128) -> Self

Constructs self from a pair of high and low underlying integers.

Source

pub const fn into_words(self) -> (u128, u128)

Returns a tuple of high and low underlying integers.

Source

pub fn from_str_radix(src: &str, radix: u32) -> Result<Self, ParseIntError>

Converts a string slice in a given base to an integer.

Source

pub const fn is_zero(&self) -> bool

Returns true if an underlying primitive integer is zero.

Source

pub const fn is_valid(&self) -> bool

Returns true if an underlying primitive integer fits into the repr.

Source

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.

Source

pub const fn leading_zeros(&self) -> u32

Returns the number of leading zeros in the binary representation of self.

Source

pub const fn saturating_add(self, rhs: &Self) -> Self

Saturating integer addition. Computes self + rhs, saturating at the numeric bounds instead of overflowing.

Source

pub const fn saturating_sub(self, rhs: &Self) -> Self

Saturating integer addition. Computes self - rhs, saturating at the numeric bounds instead of overflowing.

Source

pub fn saturating_mul(self, rhs: &Self) -> Self

Saturating integer multiplication. Computes self * rhs, returning None if overflow occurred.

Source

pub const fn checked_add(&self, rhs: &Self) -> Option<Self>

Checked integer addition. Computes self + rhs, returning None if overflow occurred.

Source

pub const fn checked_sub(&self, rhs: &Self) -> Option<Self>

Checked integer subtraction. Computes self - rhs, returning None if overflow occurred.

Source

pub fn checked_mul(&self, rhs: &Self) -> Option<Self>

Checked integer multiplication. Computes self * rhs, returning None if overflow occurred.

Source

pub const fn low(&self) -> &u128

The lower part of the integer.

Source

pub const fn high(&self) -> &u128

The higher part of the integer.

Source

pub fn low_mut(&mut self) -> &mut u128

A mutable reference to the lower part of the integer.

Source

pub fn high_mut(&mut self) -> &mut u128

A mutable reference to the higher part of the integer.

Source

pub const fn as_isize(self) -> isize

Cast to a primitive isize.

Source

pub const fn as_usize(self) -> usize

Cast to a primitive usize.

Trait Implementations§

Source§

impl Add<&VarUint248> for VarUint248

Source§

type Output = VarUint248

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &Self) -> Self::Output

Performs the + operation. Read more
Source§

impl Add<u128> for VarUint248

Source§

type Output = VarUint248

The resulting type after applying the + operator.
Source§

fn add(self, rhs: u128) -> Self::Output

Performs the + operation. Read more
Source§

impl Add for VarUint248

Source§

type Output = VarUint248

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Self) -> Self::Output

Performs the + operation. Read more
Source§

impl AddAssign<&VarUint248> for VarUint248

Source§

fn add_assign(&mut self, rhs: &Self)

Performs the += operation. Read more
Source§

impl AddAssign<u128> for VarUint248

Source§

fn add_assign(&mut self, rhs: u128)

Performs the += operation. Read more
Source§

impl AddAssign for VarUint248

Source§

fn add_assign(&mut self, rhs: Self)

Performs the += operation. Read more
Source§

impl Clone for VarUint248

Source§

fn clone(&self) -> VarUint248

Returns a duplicate of the value. Read more
1.0.0 · Source§

const fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for VarUint248

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for VarUint248

Source§

fn default() -> VarUint248

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for VarUint248

Source§

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 Display for VarUint248

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Div<&VarUint248> for VarUint248

Source§

type Output = VarUint248

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &Self) -> Self::Output

Performs the / operation. Read more
Source§

impl Div<u128> for VarUint248

Source§

type Output = VarUint248

The resulting type after applying the / operator.
Source§

fn div(self, rhs: u128) -> Self::Output

Performs the / operation. Read more
Source§

impl Div for VarUint248

Source§

type Output = VarUint248

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Self) -> Self::Output

Performs the / operation. Read more
Source§

impl DivAssign<&VarUint248> for VarUint248

Source§

fn div_assign(&mut self, rhs: &Self)

Performs the /= operation. Read more
Source§

impl DivAssign<u128> for VarUint248

Source§

fn div_assign(&mut self, rhs: u128)

Performs the /= operation. Read more
Source§

impl DivAssign for VarUint248

Source§

fn div_assign(&mut self, rhs: Self)

Performs the /= operation. Read more
Source§

impl ExactSize for VarUint248

Source§

fn exact_size(&self) -> Size

Exact size of the value when it is stored in a slice.
Source§

impl From<VarUint248> for BigInt

Source§

fn from(value: VarUint248) -> Self

Converts to this type from the input type.
Source§

impl From<VarUint248> for BigUint

Source§

fn from(value: VarUint248) -> Self

Converts to this type from the input type.
Source§

impl From<u128> for VarUint248

Source§

fn from(value: u128) -> Self

Converts to this type from the input type.
Source§

impl From<u16> for VarUint248

Source§

fn from(value: u16) -> Self

Converts to this type from the input type.
Source§

impl From<u32> for VarUint248

Source§

fn from(value: u32) -> Self

Converts to this type from the input type.
Source§

impl From<u64> for VarUint248

Source§

fn from(value: u64) -> Self

Converts to this type from the input type.
Source§

impl From<u8> for VarUint248

Source§

fn from(value: u8) -> Self

Converts to this type from the input type.
Source§

impl From<usize> for VarUint248

Source§

fn from(value: usize) -> Self

Converts to this type from the input type.
Source§

impl FromStr for VarUint248

Source§

type Err = ParseIntError

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl Hash for VarUint248

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<'a> Load<'a> for VarUint248

Source§

fn load_from(slice: &mut CellSlice<'a>) -> Result<Self, Error>

Tries to load itself from a cell slice.
Source§

impl Mul<&VarUint248> for VarUint248

Source§

type Output = VarUint248

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &Self) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<u128> for VarUint248

Source§

type Output = VarUint248

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: u128) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul for VarUint248

Source§

type Output = VarUint248

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Self) -> Self::Output

Performs the * operation. Read more
Source§

impl MulAssign<&VarUint248> for VarUint248

Source§

fn mul_assign(&mut self, rhs: &Self)

Performs the *= operation. Read more
Source§

impl MulAssign<u128> for VarUint248

Source§

fn mul_assign(&mut self, rhs: u128)

Performs the *= operation. Read more
Source§

impl MulAssign for VarUint248

Source§

fn mul_assign(&mut self, rhs: Self)

Performs the *= operation. Read more
Source§

impl Ord for VarUint248

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq<u128> for VarUint248

Source§

fn eq(&self, other: &u128) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

const fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq for VarUint248

Source§

fn eq(&self, other: &VarUint248) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

const fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd<u128> for VarUint248

Source§

fn partial_cmp(&self, other: &u128) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd for VarUint248

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Rem<&VarUint248> for VarUint248

Source§

type Output = VarUint248

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: &Self) -> Self::Output

Performs the % operation. Read more
Source§

impl Rem<u128> for VarUint248

Source§

type Output = VarUint248

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: u128) -> Self::Output

Performs the % operation. Read more
Source§

impl Rem for VarUint248

Source§

type Output = VarUint248

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: Self) -> Self::Output

Performs the % operation. Read more
Source§

impl RemAssign<&VarUint248> for VarUint248

Source§

fn rem_assign(&mut self, rhs: &Self)

Performs the %= operation. Read more
Source§

impl RemAssign<u128> for VarUint248

Source§

fn rem_assign(&mut self, rhs: u128)

Performs the %= operation. Read more
Source§

impl RemAssign for VarUint248

Source§

fn rem_assign(&mut self, rhs: Self)

Performs the %= operation. Read more
Source§

impl Serialize for VarUint248

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Shl<i32> for VarUint248

Source§

type Output = VarUint248

The resulting type after applying the << operator.
Source§

fn shl(self, rhs: i32) -> Self::Output

Performs the << operation. Read more
Source§

impl Shl<u32> for VarUint248

Source§

type Output = VarUint248

The resulting type after applying the << operator.
Source§

fn shl(self, rhs: u32) -> Self::Output

Performs the << operation. Read more
Source§

impl Shl<usize> for VarUint248

Source§

type Output = VarUint248

The resulting type after applying the << operator.
Source§

fn shl(self, rhs: usize) -> Self::Output

Performs the << operation. Read more
Source§

impl ShlAssign<usize> for VarUint248

Source§

fn shl_assign(&mut self, n: usize)

Performs the <<= operation. Read more
Source§

impl Shr<i32> for VarUint248

Source§

type Output = VarUint248

The resulting type after applying the >> operator.
Source§

fn shr(self, rhs: i32) -> Self::Output

Performs the >> operation. Read more
Source§

impl Shr<u32> for VarUint248

Source§

type Output = VarUint248

The resulting type after applying the >> operator.
Source§

fn shr(self, rhs: u32) -> Self::Output

Performs the >> operation. Read more
Source§

impl Shr<usize> for VarUint248

Source§

type Output = VarUint248

The resulting type after applying the >> operator.
Source§

fn shr(self, rhs: usize) -> Self::Output

Performs the >> operation. Read more
Source§

impl ShrAssign<usize> for VarUint248

Source§

fn shr_assign(&mut self, n: usize)

Performs the >>= operation. Read more
Source§

impl Store for VarUint248

Source§

fn store_into( &self, builder: &mut CellBuilder, _: &dyn CellContext, ) -> Result<(), Error>

Tries to store itself into the cell builder.
Source§

impl Sub<&VarUint248> for VarUint248

Source§

type Output = VarUint248

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &Self) -> Self::Output

Performs the - operation. Read more
Source§

impl Sub<u128> for VarUint248

Source§

type Output = VarUint248

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: u128) -> Self::Output

Performs the - operation. Read more
Source§

impl Sub for VarUint248

Source§

type Output = VarUint248

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Self) -> Self::Output

Performs the - operation. Read more
Source§

impl SubAssign<&VarUint248> for VarUint248

Source§

fn sub_assign(&mut self, rhs: &Self)

Performs the -= operation. Read more
Source§

impl SubAssign<u128> for VarUint248

Source§

fn sub_assign(&mut self, rhs: u128)

Performs the -= operation. Read more
Source§

impl SubAssign for VarUint248

Source§

fn sub_assign(&mut self, rhs: Self)

Performs the -= operation. Read more
Source§

impl WithAbiType for VarUint248

Source§

fn abi_type() -> AbiType

Returns a corresponding ABI type.
Source§

impl Copy for VarUint248

Source§

impl Eq for VarUint248

Source§

impl StructuralPartialEq for VarUint248

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn compare(&self, key: &K) -> Ordering

Compares self to key and returns their ordering.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compares self to key and returns true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> EquivalentRepr<T> for T

Source§

impl<T, Rhs> NumAssignOps<Rhs> for T
where T: AddAssign<Rhs> + SubAssign<Rhs> + MulAssign<Rhs> + DivAssign<Rhs> + RemAssign<Rhs>,

Source§

impl<T, Rhs, Output> NumOps<Rhs, Output> for T
where T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>,

Source§

impl<T, Base> RefNum<Base> for T
where T: NumOps<Base, Base> + for<'r> NumOps<&'r Base, Base>,