Struct ruint::Uint

source ·
pub struct Uint<const BITS: usize, const LIMBS: usize> { /* private fields */ }
Expand description

The ring of numbers modulo $2^{\mathtt{BITS}}$.

Uint implements nearly all traits and methods from the std unsigned integer types, including most nightly only ones.

§Notable differences from std uint types.

  • The operators +, -, *, etc. using wrapping math by default. The std operators panic on overflow in debug, and are undefined in release, see reference.
  • The Uint::checked_shl, Uint::overflowing_shl, etc return overflow when non-zero bits are shifted out. In std they return overflow when the shift amount is greater than the bit size.
  • Some methods like u64::div_euclid and u64::rem_euclid are left out because they are meaningless or redundant for unsigned integers. Std has them for compatibility with their signed integers.
  • Many functions that are const in std are not in Uint.
  • Uint::to_le_bytes and Uint::to_be_bytes require the output size to be provided as a const-generic argument. They will runtime panic if the provided size is incorrect.
  • Uint::widening_mul takes as argument an Uint of arbitrary size and returns a result that is sized to fit the product without overflow (i.e. the sum of the bit sizes of self and the argument). The std version requires same-sized arguments and returns a pair of lower and higher bits.

Implementations§

source§

impl<const BITS: usize, const LIMBS: usize> Uint<BITS, LIMBS>

source

pub fn abs_diff(self, other: Self) -> Self

Computes the absolute difference between self and other.

Returns $\left\vert \mathtt{self} - \mathtt{other} \right\vert$.

source

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

Computes self + rhs, returning None if overflow occurred.

source

pub const fn checked_neg(self) -> Option<Self>

Computes -self, returning None unless self == 0.

source

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

Computes self - rhs, returning None if overflow occurred.

source

pub const fn overflowing_add(self, rhs: Self) -> (Self, bool)

Calculates $\mod{\mathtt{self} + \mathtt{rhs}}_{2^{BITS}}$.

Returns a tuple of the addition along with a boolean indicating whether an arithmetic overflow would occur. If an overflow would have occurred then the wrapped value is returned.

source

pub const fn overflowing_neg(self) -> (Self, bool)

Calculates $\mod{-\mathtt{self}}_{2^{BITS}}$.

Returns !self + 1 using wrapping operations to return the value that represents the negation of this unsigned value. Note that for positive unsigned values overflow always occurs, but negating 0 does not overflow.

source

pub const fn overflowing_sub(self, rhs: Self) -> (Self, bool)

Calculates $\mod{\mathtt{self} - \mathtt{rhs}}_{2^{BITS}}$.

Returns a tuple of the subtraction along with a boolean indicating whether an arithmetic overflow would occur. If an overflow would have occurred then the wrapped value is returned.

source

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

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

source

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

Computes self - rhs, saturating at the numeric bounds instead of overflowing

source

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

Computes self + rhs, wrapping around at the boundary of the type.

source

pub const fn wrapping_neg(self) -> Self

Computes -self, wrapping around at the boundary of the type.

source

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

Computes self - rhs, wrapping around at the boundary of the type.

source§

impl<const BITS: usize, const LIMBS: usize> Uint<BITS, LIMBS>

source

pub fn to_base_le(&self, base: u64) -> impl Iterator<Item = u64>

Returns an iterator over the base base digits of the number in little-endian order.

Pro tip: instead of setting base = 10, set it to the highest power of 10 that still fits u64. This way much fewer iterations are required to extract all the digits.

§Panics

Panics if the base is less than 2.

source

pub fn to_base_be(&self, base: u64) -> impl Iterator<Item = u64>

Available on crate feature alloc only.

Returns an iterator over the base base digits of the number in big-endian order.

Pro tip: instead of setting base = 10, set it to the highest power of 10 that still fits u64. This way much fewer iterations are required to extract all the digits.

§Panics

Panics if the base is less than 2.

source

pub fn from_base_le<I>(base: u64, digits: I) -> Result<Self, BaseConvertError>
where I: IntoIterator<Item = u64>,

Constructs the Uint from digits in the base base in little-endian.

§Errors
source

pub fn from_base_be<I: IntoIterator<Item = u64>>( base: u64, digits: I ) -> Result<Self, BaseConvertError>

Constructs the Uint from digits in the base base in big-endian.

§Errors
source§

impl<const BITS: usize, const LIMBS: usize> Uint<BITS, LIMBS>

source

pub const fn bit(&self, index: usize) -> bool

Returns whether a specific bit is set.

Returns false if index exceeds the bit width of the number.

source

pub fn set_bit(&mut self, index: usize, value: bool)

Sets a specific bit to a value.

source

pub const fn byte(&self, index: usize) -> u8

Returns a specific byte. The byte at index 0 is the least significant byte (little endian).

§Panics

Panics if index exceeds the byte width of the number.

§Examples
let x = uint!(0x1234567890_U64);
let bytes = [
    x.byte(0), // 0x90
    x.byte(1), // 0x78
    x.byte(2), // 0x56
    x.byte(3), // 0x34
    x.byte(4), // 0x12
    x.byte(5), // 0x00
    x.byte(6), // 0x00
    x.byte(7), // 0x00
];
assert_eq!(bytes, x.to_le_bytes());

Panics if out of range.

let x = uint!(0x1234567890_U64);
let _ = x.byte(8);
source

pub fn reverse_bits(self) -> Self

Reverses the order of bits in the integer. The least significant bit becomes the most significant bit, second least-significant bit becomes second most-significant bit, etc.

source

pub fn leading_zeros(&self) -> usize

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

source

pub fn leading_ones(&self) -> usize

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

source

pub fn trailing_zeros(&self) -> usize

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

source

pub fn trailing_ones(&self) -> usize

Returns the number of trailing ones in the binary representation of self.

source

pub fn count_ones(&self) -> usize

Returns the number of ones in the binary representation of self.

source

pub fn count_zeros(&self) -> usize

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

source

pub fn bit_len(&self) -> usize

Length of the number in bits ignoring leading zeros.

source

pub fn byte_len(&self) -> usize

Length of the number in bytes ignoring leading zeros.

source

pub fn most_significant_bits(&self) -> (u64, usize)

Returns the most significant 64 bits of the number and the exponent.

Given return value $(\mathtt{bits}, \mathtt{exponent})$, the self can be approximated as

$$ \mathtt{self} ≈ \mathtt{bits} ⋅ 2^\mathtt{exponent} $$

If self is $<≥> 2^{63}$, then exponent will be zero and bits will have leading zeros.

source

pub fn checked_shl(self, rhs: usize) -> Option<Self>

Checked left shift by rhs bits.

Returns $\mathtt{self} ⋅ 2^{\mathtt{rhs}}$ or None if the result would $≥ 2^{\mathtt{BITS}}$. That is, it returns None if the bits shifted out would be non-zero.

Note: This differs from u64::checked_shl which returns None if the shift is larger than BITS (which is IMHO not very useful).

source

pub fn saturating_shl(self, rhs: usize) -> Self

Saturating left shift by rhs bits.

Returns $\mathtt{self} ⋅ 2^{\mathtt{rhs}}$ or Uint::MAX if the result would $≥ 2^{\mathtt{BITS}}$. That is, it returns Uint::MAX if the bits shifted out would be non-zero.

source

pub fn overflowing_shl(self, rhs: usize) -> (Self, bool)

Left shift by rhs bits with overflow detection.

Returns $\mod{\mathtt{value} ⋅ 2^{\mathtt{rhs}}}_{2^{\mathtt{BITS}}}$. If the product is $≥ 2^{\mathtt{BITS}}$ it returns true. That is, it returns true if the bits shifted out are non-zero.

Note: This differs from u64::overflowing_shl which returns true if the shift is larger than BITS (which is IMHO not very useful).

source

pub fn wrapping_shl(self, rhs: usize) -> Self

Left shift by rhs bits.

Returns $\mod{\mathtt{value} ⋅ 2^{\mathtt{rhs}}}_{2^{\mathtt{BITS}}}$.

Note: This differs from u64::wrapping_shl which first reduces rhs by BITS (which is IMHO not very useful).

source

pub fn checked_shr(self, rhs: usize) -> Option<Self>

Checked right shift by rhs bits.

$$ \frac{\mathtt{self}}{2^{\mathtt{rhs}}} $$

Returns the above or None if the division is not exact. This is the same as

Note: This differs from u64::checked_shr which returns None if the shift is larger than BITS (which is IMHO not very useful).

source

pub fn overflowing_shr(self, rhs: usize) -> (Self, bool)

Right shift by rhs bits with underflow detection.

$$ \floor{\frac{\mathtt{self}}{2^{\mathtt{rhs}}}} $$

Returns the above and false if the division was exact, and true if it was rounded down. This is the same as non-zero bits being shifted out.

Note: This differs from u64::overflowing_shr which returns true if the shift is larger than BITS (which is IMHO not very useful).

source

pub fn wrapping_shr(self, rhs: usize) -> Self

Right shift by rhs bits.

$$ \mathtt{wrapping\_shr}(\mathtt{self}, \mathtt{rhs}) = \floor{\frac{\mathtt{self}}{2^{\mathtt{rhs}}}} $$

Note: This differs from u64::wrapping_shr which first reduces rhs by BITS (which is IMHO not very useful).

source

pub fn arithmetic_shr(self, rhs: usize) -> Self

Arithmetic shift right by rhs bits.

source

pub fn rotate_left(self, rhs: usize) -> Self

Shifts the bits to the left by a specified amount, rhs, wrapping the truncated bits to the end of the resulting integer.

source

pub fn rotate_right(self, rhs: usize) -> Self

Shifts the bits to the right by a specified amount, rhs, wrapping the truncated bits to the beginning of the resulting integer.

source§

impl<const BITS: usize, const LIMBS: usize> Uint<BITS, LIMBS>

source

pub const BYTES: usize = _

The size of this integer type in bytes. Note that some bits may be forced zero if BITS is not cleanly divisible by eight.

source

pub const fn as_le_slice(&self) -> &[u8]

Available on little-endian only.

Access the underlying store as a little-endian slice of bytes.

Only available on little-endian targets.

If BITS does not evenly divide 8, it is padded with zero bits in the most significant position.

source

pub unsafe fn as_le_slice_mut(&mut self) -> &mut [u8]

Available on little-endian only.

Access the underlying store as a mutable little-endian slice of bytes.

Only available on litte-endian targets.

§Safety

If BITS does not evenly divide 8, it is padded with zero bits in the most significant position. Setting those bits puts the Uint in an invalid state.

source

pub fn as_le_bytes(&self) -> Cow<'_, [u8]>

Available on crate feature alloc only.

Access the underlying store as a little-endian bytes.

Uses an optimized implementation on little-endian targets.

source

pub fn as_le_bytes_trimmed(&self) -> Cow<'_, [u8]>

Available on crate feature alloc only.

Access the underlying store as a little-endian bytes with trailing zeros removed.

Uses an optimized implementation on little-endian targets.

source

pub const fn to_le_bytes<const BYTES: usize>(&self) -> [u8; BYTES]

Converts the Uint to a little-endian byte array of size exactly Self::BYTES.

§Panics

Panics if the generic parameter BYTES is not exactly Self::BYTES. Ideally this would be a compile time error, but this is blocked by Rust issue #60551.

source

pub fn to_le_bytes_vec(&self) -> Vec<u8>

Available on crate feature alloc only.

Converts the Uint to a little-endian byte vector of size exactly Self::BYTES.

This method is useful when Self::to_le_bytes can not be used because byte size is not known compile time.

source

pub fn to_le_bytes_trimmed_vec(&self) -> Vec<u8>

Available on crate feature alloc only.

Converts the Uint to a little-endian byte vector with trailing zeros bytes removed.

source

pub const fn to_be_bytes<const BYTES: usize>(&self) -> [u8; BYTES]

Converts the Uint to a big-endian byte array of size exactly Self::BYTES.

§Panics

Panics if the generic parameter BYTES is not exactly Self::BYTES. Ideally this would be a compile time error, but this is blocked by Rust issue #60551.

source

pub fn to_be_bytes_vec(&self) -> Vec<u8>

Available on crate feature alloc only.

Converts the Uint to a big-endian byte vector of size exactly Self::BYTES.

This method is useful when Self::to_be_bytes can not be used because byte size is not known compile time.

source

pub fn to_be_bytes_trimmed_vec(&self) -> Vec<u8>

Available on crate feature alloc only.

Converts the Uint to a big-endian byte vector with leading zeros bytes removed.

source

pub const fn from_be_bytes<const BYTES: usize>(bytes: [u8; BYTES]) -> Self

Converts a big-endian byte array of size exactly Self::BYTES to Uint.

§Panics

Panics if the generic parameter BYTES is not exactly Self::BYTES. Ideally this would be a compile time error, but this is blocked by Rust issue #60551.

Panics if the value is too large for the bit-size of the Uint.

source

pub const fn from_be_slice(bytes: &[u8]) -> Self

Creates a new integer from a big endian slice of bytes.

The slice is interpreted as a big endian number. Leading zeros are ignored. The slice can be any length.

§Panics

Panics if the value is larger than fits the Uint.

source

pub const fn try_from_be_slice(bytes: &[u8]) -> Option<Self>

Creates a new integer from a big endian slice of bytes.

The slice is interpreted as a big endian number. Leading zeros are ignored. The slice can be any length.

Returns None if the value is larger than fits the Uint.

source

pub const fn from_le_bytes<const BYTES: usize>(bytes: [u8; BYTES]) -> Self

Converts a little-endian byte array of size exactly Self::BYTES to Uint.

§Panics

Panics if the generic parameter BYTES is not exactly Self::BYTES. Ideally this would be a compile time error, but this is blocked by Rust issue #60551.

Panics if the value is too large for the bit-size of the Uint.

source

pub const fn from_le_slice(bytes: &[u8]) -> Self

Creates a new integer from a little endian slice of bytes.

The slice is interpreted as a little endian number. Leading zeros are ignored. The slice can be any length.

§Panics

Panics if the value is larger than fits the Uint.

source

pub const fn try_from_le_slice(bytes: &[u8]) -> Option<Self>

Creates a new integer from a little endian slice of bytes.

The slice is interpreted as a little endian number. Leading zeros are ignored. The slice can be any length.

Returns None if the value is larger than fits the Uint.

source§

impl<const BITS: usize, const LIMBS: usize> Uint<BITS, LIMBS>

source

pub fn is_zero(&self) -> bool

Returns true if the value is zero.

source§

impl<const BITS: usize, const LIMBS: usize> Uint<BITS, LIMBS>

source

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

Computes self / rhs, returning None if rhs == 0.

source

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

Computes self % rhs, returning None if rhs == 0.

source

pub fn div_ceil(self, rhs: Self) -> Self

Computes self / rhs rounding up.

§Panics

Panics if rhs == 0.

source

pub fn div_rem(self, rhs: Self) -> (Self, Self)

Computes self / rhs and self % rhs.

§Panics

Panics if rhs == 0.

source

pub fn wrapping_div(self, rhs: Self) -> Self

Computes self / rhs rounding down.

§Panics

Panics if rhs == 0.

source

pub fn wrapping_rem(self, rhs: Self) -> Self

Computes self % rhs.

§Panics

Panics if rhs == 0.

source§

impl<const BITS: usize, const LIMBS: usize> Uint<BITS, LIMBS>

source

pub fn from<T>(value: T) -> Self
where Self: UintTryFrom<T>,

Construct a new Uint from the value.

§Panics

Panics if the conversion fails, for example if the value is too large for the bit-size of the Uint. The panic will be attributed to the call site.

§Examples
assert_eq!(U8::from(142_u16), 142_U8);
assert_eq!(U64::from(0x7014b4c2d1f2_U256), 0x7014b4c2d1f2_U64);
assert_eq!(U64::from(3.145), 3_U64);
source

pub fn saturating_from<T>(value: T) -> Self
where Self: UintTryFrom<T>,

Construct a new Uint from the value saturating the value to the minimum or maximum value of the Uint.

If the value is not a number (like f64::NAN), then the result is set zero.

§Examples
assert_eq!(U8::saturating_from(300_u16), 255_U8);
assert_eq!(U8::saturating_from(-10_i16), 0_U8);
assert_eq!(U32::saturating_from(0x7014b4c2d1f2_U256), U32::MAX);
source

pub fn wrapping_from<T>(value: T) -> Self
where Self: UintTryFrom<T>,

Construct a new Uint from the value saturating the value to the minimum or maximum value of the Uint.

If the value is not a number (like f64::NAN), then the result is set zero.

§Examples
assert_eq!(U8::wrapping_from(300_u16), 44_U8);
assert_eq!(U8::wrapping_from(-10_i16), 246_U8);
assert_eq!(U32::wrapping_from(0x7014b4c2d1f2_U256), 0xb4c2d1f2_U32);
source

pub fn to<T>(&self) -> T
where Self: UintTryTo<T>, T: Debug,

§Panics

Panics if the conversion fails, for example if the value is too large for the bit-size of the target type.

§Examples
assert_eq!(300_U12.to::<i16>(), 300_i16);
assert_eq!(300_U12.to::<U256>(), 300_U256);
source

pub fn wrapping_to<T>(&self) -> T
where Self: UintTryTo<T>,

§Examples
assert_eq!(300_U12.wrapping_to::<i8>(), 44_i8);
assert_eq!(255_U32.wrapping_to::<i8>(), -1_i8);
assert_eq!(0x1337cafec0d3_U256.wrapping_to::<U32>(), 0xcafec0d3_U32);
source

pub fn saturating_to<T>(&self) -> T
where Self: UintTryTo<T>,

§Examples
assert_eq!(300_U12.saturating_to::<i16>(), 300_i16);
assert_eq!(255_U32.saturating_to::<i8>(), 127);
assert_eq!(0x1337cafec0d3_U256.saturating_to::<U32>(), U32::MAX);
source§

impl<const BITS: usize, const LIMBS: usize> Uint<BITS, LIMBS>

source

pub fn gcd(self, other: Self) -> Self

Compute the greatest common divisor of two Uints.

§Examples
assert_eq!(0_U128.gcd(0_U128), 0_U128);
source

pub fn lcm(self, other: Self) -> Option<Self>

Compute the least common multiple of two Uints or None if the result would be too large.

source

pub fn gcd_extended(self, other: Self) -> (Self, Self, Self, bool)

⚠️ Compute the greatest common divisor and the Bézout coefficients.

Warning. This is API is unstable and may change in a minor release.

Returns $(\mathtt{gcd}, \mathtt{x}, \mathtt{y}, \mathtt{sign})$ such that

$$ \gcd(\mathtt{self}, \mathtt{other}) = \mathtt{gcd} = \begin{cases} \mathtt{self} · \mathtt{x} - \mathtt{other} . \mathtt{y} & \mathtt{sign} \\ \mathtt{other} · \mathtt{y} - \mathtt{self} · \mathtt{x} & ¬\mathtt{sign} \end{cases} $$

Note that the intermediate products may overflow, even though the result after subtraction will fit in the bit size of the Uint.

source§

impl<const BITS: usize, const LIMBS: usize> Uint<BITS, LIMBS>

source

pub fn checked_log(self, base: Self) -> Option<usize>

Available on crate feature std only.

Returns the logarithm of the number, rounded down.

Returns None if the base is less than two, or this number is zero.

source

pub fn checked_log10(self) -> Option<usize>

Available on crate feature std only.

Returns the base 10 logarithm of the number, rounded down.

Returns None if the number is zero.

source

pub fn checked_log2(self) -> Option<usize>

Available on crate feature std only.

Returns the base 2 logarithm of the number, rounded down.

This is equivalent to the index of the highest set bit.

Returns None if the number is zero.

source

pub fn log(self, base: Self) -> usize

Available on crate feature std only.

Returns the logarithm of the number, rounded down.

§Panics

Panics if the base is less than 2 or if the number is zero.

source

pub fn log10(self) -> usize

Available on crate feature std only.

Returns the base 10 logarithm of the number, rounded down.

§Panics

Panics if the base if the number is zero.

source

pub fn log2(self) -> usize

Available on crate feature std only.

Returns the base 2 logarithm of the number, rounded down.

§Panics

Panics if the base if the number is zero.

source

pub fn approx_log(self, base: f64) -> f64

Available on crate feature std only.

Double precision logarithm.

source

pub fn approx_log2(self) -> f64

Available on crate feature std only.

Double precision binary logarithm.

§Examples
assert_eq!(0_U64.approx_log2(), f64::NEG_INFINITY);
assert_eq!(1_U64.approx_log2(), 0.0);
assert_eq!(2_U64.approx_log2(), 1.0);
assert_eq!(U64::MAX.approx_log2(), 64.0);
source

pub fn approx_log10(self) -> f64

Available on crate feature std only.

Double precision decimal logarithm.

source§

impl<const BITS: usize, const LIMBS: usize> Uint<BITS, LIMBS>

source

pub fn reduce_mod(self, modulus: Self) -> Self

⚠️ Compute $\mod{\mathtt{self}}_{\mathtt{modulus}}$.

Warning. This function is not part of the stable API.

Returns zero if the modulus is zero.

source

pub fn add_mod(self, rhs: Self, modulus: Self) -> Self

Compute $\mod{\mathtt{self} + \mathtt{rhs}}_{\mathtt{modulus}}$.

Returns zero if the modulus is zero.

source

pub fn mul_mod(self, rhs: Self, modulus: Self) -> Self

Compute $\mod{\mathtt{self} ⋅ \mathtt{rhs}}_{\mathtt{modulus}}$.

Returns zero if the modulus is zero.

See mul_redc for a faster variant at the cost of some pre-computation.

source

pub fn pow_mod(self, exp: Self, modulus: Self) -> Self

Compute $\mod{\mathtt{self}^{\mathtt{rhs}}}_{\mathtt{modulus}}$.

Returns zero if the modulus is zero.

source

pub fn inv_mod(self, modulus: Self) -> Option<Self>

Compute $\mod{\mathtt{self}^{-1}}_{\mathtt{modulus}}$.

Returns None if the inverse does not exist.

source

pub fn mul_redc(self, other: Self, modulus: Self, inv: u64) -> Self

Available on crate feature alloc only.

Montgomery multiplication.

Computes

$$ \mod{\frac{\mathtt{self} ⋅ \mathtt{other}}{ 2^{64 · \mathtt{LIMBS}}}}_{\mathtt{modulus}} $$

This is useful because it can be computed notably faster than mul_mod. Many computations can be done by pre-multiplying values with $R = 2^{64 · \mathtt{LIMBS}}$ and then using mul_redc instead of mul_mod.

For this algorithm to work, it needs an extra parameter inv which must be set to

$$ \mathtt{inv} = \mod{\frac{-1}{\mathtt{modulus}} }_{2^{64}} $$

The inv value only exists for odd values of modulus. It can be computed using inv_ring from U64.

let inv = U64::wrapping_from(modulus).inv_ring().unwrap().wrapping_neg().to();
let prod = 5_U256.mul_redc(6_U256, modulus, inv);
§Panics

Panics if inv is not correct.

source§

impl<const BITS: usize, const LIMBS: usize> Uint<BITS, LIMBS>

source

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

Computes self * rhs, returning None if overflow occurred.

source

pub fn overflowing_mul(self, rhs: Self) -> (Self, bool)

Calculates the multiplication of self and rhs.

Returns a tuple of the multiplication along with a boolean indicating whether an arithmetic overflow would occur. If an overflow would have occurred then the wrapped value is returned.

§Examples
assert_eq!(1_U1.overflowing_mul(1_U1), (1_U1, false));
assert_eq!(
    0x010000000000000000_U65.overflowing_mul(0x010000000000000000_U65),
    (0x000000000000000000_U65, true)
);
source

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

Computes self * rhs, saturating at the numeric bounds instead of overflowing.

source

pub fn wrapping_mul(self, rhs: Self) -> Self

Computes self * rhs, wrapping around at the boundary of the type.

source

pub fn inv_ring(self) -> Option<Self>

Computes the inverse modulo $2^{\mathtt{BITS}}$ of self, returning None if the inverse does not exist.

source

pub fn widening_mul<const BITS_RHS: usize, const LIMBS_RHS: usize, const BITS_RES: usize, const LIMBS_RES: usize>( self, rhs: Uint<BITS_RHS, LIMBS_RHS> ) -> Uint<BITS_RES, LIMBS_RES>

Calculates the complete product self * rhs without the possibility to overflow.

The argument rhs can be any size Uint, the result size is the sum of the bit-sizes of self and rhs.

§Panics

This function will runtime panic of the const generic arguments are incorrect.

§Examples
assert_eq!(0_U0.widening_mul(0_U0), 0_U0);
assert_eq!(1_U1.widening_mul(1_U1), 1_U2);
assert_eq!(3_U2.widening_mul(7_U3), 21_U5);
source§

impl<const BITS: usize, const LIMBS: usize> Uint<BITS, LIMBS>

source

pub fn checked_pow(self, exp: Self) -> Option<Self>

Raises self to the power of exp.

Returns None if the result would overflow.

source

pub fn overflowing_pow(self, exp: Self) -> (Self, bool)

Raises self to the power of exp and if the result would overflow.

§Examples
assert_eq!(
    36_U64.overflowing_pow(12_U64),
    (0x41c21cb8e1000000_U64, false)
);
assert_eq!(
    36_U64.overflowing_pow(13_U64),
    (0x3f4c09ffa4000000_U64, true)
);
assert_eq!(
    36_U68.overflowing_pow(13_U68),
    (0x093f4c09ffa4000000_U68, false)
);
assert_eq!(16_U65.overflowing_pow(32_U65), (0_U65, true));

Small cases:

assert_eq!(0_U0.overflowing_pow(0_U0), (0_U0, false));
assert_eq!(0_U1.overflowing_pow(0_U1), (1_U1, false));
assert_eq!(0_U1.overflowing_pow(1_U1), (0_U1, false));
assert_eq!(1_U1.overflowing_pow(0_U1), (1_U1, false));
assert_eq!(1_U1.overflowing_pow(1_U1), (1_U1, false));
source

pub fn pow(self, exp: Self) -> Self

Raises self to the power of exp, wrapping around on overflow.

source

pub fn saturating_pow(self, exp: Self) -> Self

Raises self to the power of exp, saturating on overflow.

source

pub fn wrapping_pow(self, exp: Self) -> Self

Raises self to the power of exp, wrapping around on overflow.

source

pub fn approx_pow2(exp: f64) -> Option<Self>

Available on crate feature std only.

Construct from double precision binary logarithm.

§Examples
assert_eq!(U64::approx_pow2(-2.0), Some(0_U64));
assert_eq!(U64::approx_pow2(-1.0), Some(1_U64));
assert_eq!(U64::approx_pow2(0.0), Some(1_U64));
assert_eq!(U64::approx_pow2(1.0), Some(2_U64));
assert_eq!(U64::approx_pow2(1.6), Some(3_U64));
assert_eq!(U64::approx_pow2(2.0), Some(4_U64));
assert_eq!(U64::approx_pow2(64.0), None);
assert_eq!(U64::approx_pow2(10.385), Some(1337_U64));
source§

impl<const BITS: usize, const LIMBS: usize> Uint<BITS, LIMBS>

source

pub fn root(self, degree: usize) -> Self

Available on crate feature std only.

Computes the floor of the degree-th root of the number.

$$ \floor{\sqrt[\mathtt{degree}]{\mathtt{self}}} $$

§Panics

Panics if degree is zero.

§Examples
assert_eq!(0_U64.root(2), 0_U64);
assert_eq!(1_U64.root(63), 1_U64);
assert_eq!(0x0032da8b0f88575d_U63.root(64), 1_U63);
assert_eq!(0x1756800000000000_U63.root(34), 3_U63);
source§

impl<const BITS: usize, const LIMBS: usize> Uint<BITS, LIMBS>

source

pub fn is_power_of_two(self) -> bool

Returns true if and only if self == 2^k for some k.

source

pub fn next_power_of_two(self) -> Self

Returns the smallest power of two greater than or equal to self.

§Panics

Panics if the value overlfows.

source

pub fn checked_next_power_of_two(self) -> Option<Self>

Returns the smallest power of two greater than or equal to self. If the next power of two is greater than the type’s maximum value, None is returned, otherwise the power of two is wrapped in Some.

§Examples
assert_eq!(0_U64.checked_next_power_of_two(), Some(1_U64));
assert_eq!(1_U64.checked_next_power_of_two(), Some(1_U64));
assert_eq!(2_U64.checked_next_power_of_two(), Some(2_U64));
assert_eq!(3_U64.checked_next_power_of_two(), Some(4_U64));
assert_eq!(U64::MAX.checked_next_power_of_two(), None);
source§

impl<const BITS: usize, const LIMBS: usize> Uint<BITS, LIMBS>

source

pub fn next_multiple_of(self, rhs: Self) -> Self

Calculates the smallest value greater than or equal to self that is a multiple of rhs.

§Panics

This function will panic if rhs is 0 or the operation results in overflow.

source

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

Calculates the smallest value greater than or equal to self that is a multiple of rhs. Returns None is rhs is zero or the operation would result in overflow.

§Examples
assert_eq!(16_U64.checked_next_multiple_of(8_U64), Some(16_U64));
assert_eq!(23_U64.checked_next_multiple_of(8_U64), Some(24_U64));
assert_eq!(1_U64.checked_next_multiple_of(0_U64), None);
assert_eq!(U64::MAX.checked_next_multiple_of(2_U64), None);
}
assert_eq!(0_U0.checked_next_multiple_of(0_U0), None);
assert_eq!(0_U1.checked_next_multiple_of(0_U1), None);
assert_eq!(0_U1.checked_next_multiple_of(1_U1), Some(0_U1));
assert_eq!(1_U1.checked_next_multiple_of(0_U1), None);
assert_eq!(1_U1.checked_next_multiple_of(1_U1), Some(1_U1));
}
source§

impl<const BITS: usize, const LIMBS: usize> Uint<BITS, LIMBS>

source

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

Parse a string into a Uint.

For bases 2 to 36, the case-agnostic alphabet 0—1, a—b is used and _ are ignored. For bases 37 to 64, the case-sensitive alphabet a—z, A—Z, 0—9, {+-}, {/,_} is used. That is, for base 64 it is compatible with all the common base64 variants.

§Errors
source§

impl<const BITS: usize, const LIMBS: usize> Uint<BITS, LIMBS>

source

pub const LIMBS: usize = _

The size of this integer type in 64-bit limbs.

source

pub const MASK: u64 = _

Bit mask for the last limb.

source

pub const BITS: usize = BITS

The size of this integer type in bits.

source

pub const ZERO: Self = _

The value zero. This is the only value that exists in all Uint types.

source

pub const MIN: Self = Self::ZERO

The smallest value that can be represented by this integer type. Synonym for Self::ZERO.

source

pub const MAX: Self = _

The largest value that can be represented by this integer type, $2^{\mathtt{BITS}} − 1$.

source

pub const fn as_limbs(&self) -> &[u64; LIMBS]

View the array of limbs.

source

pub unsafe fn as_limbs_mut(&mut self) -> &mut [u64; LIMBS]

Access the array of limbs.

§Safety

This function is unsafe because it allows setting a bit outside the bit size if the bit-size is not limb-aligned.

source

pub const fn into_limbs(self) -> [u64; LIMBS]

Convert to a array of limbs.

Limbs are least significant first.

source

pub const fn from_limbs(limbs: [u64; LIMBS]) -> Self

Construct a new integer from little-endian a array of limbs.

§Panics

Panics it LIMBS is not equal to nlimbs(BITS).

Panics if the value is to large for the bit-size of the Uint.

source

pub fn from_limbs_slice(slice: &[u64]) -> Self

Construct a new integer from little-endian a slice of limbs.

§Panics

Panics if the value is to large for the bit-size of the Uint.

source

pub fn checked_from_limbs_slice(slice: &[u64]) -> Option<Self>

Construct a new integer from little-endian a slice of limbs, or None if the value is too large for the Uint.

source

pub fn wrapping_from_limbs_slice(slice: &[u64]) -> Self

Construct a new Uint from a little-endian slice of limbs. Returns a potentially truncated value.

source

pub fn overflowing_from_limbs_slice(slice: &[u64]) -> (Self, bool)

Construct a new Uint from a little-endian slice of limbs. Returns a potentially truncated value and a boolean indicating whether the value was truncated.

source

pub fn saturating_from_limbs_slice(slice: &[u64]) -> Self

Construct a new Uint from a little-endian slice of limbs. Returns the maximum value if the value is too large for the Uint.

Trait Implementations§

source§

impl<const BITS: usize, const LIMBS: usize> Add<&Uint<BITS, LIMBS>> for &Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

The resulting type after applying the + operator.
source§

fn add(self, rhs: &Uint<BITS, LIMBS>) -> Self::Output

Performs the + operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Add<&Uint<BITS, LIMBS>> for Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

The resulting type after applying the + operator.
source§

fn add(self, rhs: &Uint<BITS, LIMBS>) -> Self::Output

Performs the + operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Add<Uint<BITS, LIMBS>> for &Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

The resulting type after applying the + operator.
source§

fn add(self, rhs: Uint<BITS, LIMBS>) -> Self::Output

Performs the + operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Add for Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

The resulting type after applying the + operator.
source§

fn add(self, rhs: Uint<BITS, LIMBS>) -> Self::Output

Performs the + operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> AddAssign<&Uint<BITS, LIMBS>> for Uint<BITS, LIMBS>

source§

fn add_assign(&mut self, rhs: &Uint<BITS, LIMBS>)

Performs the += operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> AddAssign for Uint<BITS, LIMBS>

source§

fn add_assign(&mut self, rhs: Uint<BITS, LIMBS>)

Performs the += operation. Read more
source§

impl<'a, const BITS: usize, const LIMBS: usize> Arbitrary<'a> for Uint<BITS, LIMBS>

Available on crate feature arbitrary only.
source§

fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>

Generate an arbitrary value of Self from the given unstructured data. Read more
source§

fn size_hint(_depth: usize) -> (usize, Option<usize>)

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more
source§

fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>

Generate an arbitrary value of Self from the entirety of the given unstructured data. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Arbitrary for Uint<BITS, LIMBS>

Available on crate feature quickcheck only.
source§

fn arbitrary(g: &mut Gen) -> Self

Return an arbitrary value. Read more
source§

fn shrink(&self) -> Box<dyn Iterator<Item = Self>>

Return an iterator of values that are smaller than itself. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Arbitrary for Uint<BITS, LIMBS>

Available on crate feature proptest only.
§

type Parameters = ()

The type of parameters that arbitrary_with accepts for configuration of the generated Strategy. Parameters must implement Default.
§

type Strategy = Map<<[u64; LIMBS] as Arbitrary>::Strategy, fn(_: [u64; LIMBS]) -> Uint<BITS, LIMBS>>

The type of Strategy used to generate values of type Self.
source§

fn arbitrary() -> Self::Strategy

Generates a Strategy for producing arbitrary values of type the implementing type (Self). Read more
source§

fn arbitrary_with((): Self::Parameters) -> Self::Strategy

Generates a Strategy for producing arbitrary values of type the implementing type (Self). The strategy is passed the arguments given in args. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Binary for Uint<BITS, LIMBS>

Available on crate feature alloc only.
source§

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

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

impl<const BITS: usize, const LIMBS: usize> BitAnd<&Uint<BITS, LIMBS>> for &Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: &Uint<BITS, LIMBS>) -> Self::Output

Performs the & operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> BitAnd<&Uint<BITS, LIMBS>> for Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: &Uint<BITS, LIMBS>) -> Self::Output

Performs the & operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> BitAnd<Uint<BITS, LIMBS>> for &Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: Uint<BITS, LIMBS>) -> Self::Output

Performs the & operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> BitAnd for Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: Uint<BITS, LIMBS>) -> Self::Output

Performs the & operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> BitAndAssign<&Uint<BITS, LIMBS>> for Uint<BITS, LIMBS>

source§

fn bitand_assign(&mut self, rhs: &Uint<BITS, LIMBS>)

Performs the &= operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> BitAndAssign for Uint<BITS, LIMBS>

source§

fn bitand_assign(&mut self, rhs: Uint<BITS, LIMBS>)

Performs the &= operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> BitOr<&Uint<BITS, LIMBS>> for &Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: &Uint<BITS, LIMBS>) -> Self::Output

Performs the | operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> BitOr<&Uint<BITS, LIMBS>> for Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: &Uint<BITS, LIMBS>) -> Self::Output

Performs the | operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> BitOr<Uint<BITS, LIMBS>> for &Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: Uint<BITS, LIMBS>) -> Self::Output

Performs the | operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> BitOr for Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: Uint<BITS, LIMBS>) -> Self::Output

Performs the | operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> BitOrAssign<&Uint<BITS, LIMBS>> for Uint<BITS, LIMBS>

source§

fn bitor_assign(&mut self, rhs: &Uint<BITS, LIMBS>)

Performs the |= operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> BitOrAssign for Uint<BITS, LIMBS>

source§

fn bitor_assign(&mut self, rhs: Uint<BITS, LIMBS>)

Performs the |= operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> BitXor<&Uint<BITS, LIMBS>> for &Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: &Uint<BITS, LIMBS>) -> Self::Output

Performs the ^ operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> BitXor<&Uint<BITS, LIMBS>> for Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: &Uint<BITS, LIMBS>) -> Self::Output

Performs the ^ operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> BitXor<Uint<BITS, LIMBS>> for &Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: Uint<BITS, LIMBS>) -> Self::Output

Performs the ^ operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> BitXor for Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: Uint<BITS, LIMBS>) -> Self::Output

Performs the ^ operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> BitXorAssign<&Uint<BITS, LIMBS>> for Uint<BITS, LIMBS>

source§

fn bitxor_assign(&mut self, rhs: &Uint<BITS, LIMBS>)

Performs the ^= operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> BitXorAssign for Uint<BITS, LIMBS>

source§

fn bitxor_assign(&mut self, rhs: Uint<BITS, LIMBS>)

Performs the ^= operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Bounded for Uint<BITS, LIMBS>

Available on crate feature num-traits only.
source§

fn min_value() -> Self

Returns the smallest finite number this type can represent
source§

fn max_value() -> Self

Returns the largest finite number this type can represent
source§

impl<const BITS: usize, const LIMBS: usize> CheckedAdd for Uint<BITS, LIMBS>

Available on crate feature num-traits only.
source§

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

Adds two numbers, checking for overflow. If overflow happens, None is returned.
source§

impl<const BITS: usize, const LIMBS: usize> CheckedDiv for Uint<BITS, LIMBS>

Available on crate feature num-traits only.
source§

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

Divides two numbers, checking for underflow, overflow and division by zero. If any of that happens, None is returned.
source§

impl<const BITS: usize, const LIMBS: usize> CheckedEuclid for Uint<BITS, LIMBS>

Available on crate feature num-traits only.
source§

fn checked_div_euclid(&self, v: &Self) -> Option<Self>

Performs euclid division that returns None instead of panicking on division by zero and instead of wrapping around on underflow and overflow.
source§

fn checked_rem_euclid(&self, v: &Self) -> Option<Self>

Finds the euclid remainder of dividing two numbers, checking for underflow, overflow and division by zero. If any of that happens, None is returned.
source§

fn checked_div_rem_euclid(&self, v: &Self) -> Option<(Self, Self)>

Returns both the quotient and remainder from checked Euclidean division. Read more
source§

impl<const BITS: usize, const LIMBS: usize> CheckedMul for Uint<BITS, LIMBS>

Available on crate feature num-traits only.
source§

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

Multiplies two numbers, checking for underflow or overflow. If underflow or overflow happens, None is returned.
source§

impl<const BITS: usize, const LIMBS: usize> CheckedNeg for Uint<BITS, LIMBS>

Available on crate feature num-traits only.
source§

fn checked_neg(&self) -> Option<Self>

Negates a number, returning None for results that can’t be represented, like signed MIN values that can’t be positive, or non-zero unsigned values that can’t be negative. Read more
source§

impl<const BITS: usize, const LIMBS: usize> CheckedRem for Uint<BITS, LIMBS>

Available on crate feature num-traits only.
source§

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

Finds the remainder of dividing two numbers, checking for underflow, overflow and division by zero. If any of that happens, None is returned. Read more
source§

impl<const BITS: usize, const LIMBS: usize> CheckedShl for Uint<BITS, LIMBS>

Available on crate feature num-traits only.
source§

fn checked_shl(&self, other: u32) -> Option<Self>

Checked shift left. Computes self << rhs, returning None if rhs is larger than or equal to the number of bits in self. Read more
source§

impl<const BITS: usize, const LIMBS: usize> CheckedShr for Uint<BITS, LIMBS>

Available on crate feature num-traits only.
source§

fn checked_shr(&self, other: u32) -> Option<Self>

Checked shift right. Computes self >> rhs, returning None if rhs is larger than or equal to the number of bits in self. Read more
source§

impl<const BITS: usize, const LIMBS: usize> CheckedSub for Uint<BITS, LIMBS>

Available on crate feature num-traits only.
source§

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

Subtracts two numbers, checking for underflow. If underflow happens, None is returned.
source§

impl<const BITS: usize, const LIMBS: usize> Clone for Uint<BITS, LIMBS>

source§

fn clone(&self) -> Uint<BITS, LIMBS>

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Debug for Uint<BITS, LIMBS>

Available on crate feature alloc only.
source§

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

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

impl<const BITS: usize, const LIMBS: usize> Decodable for Uint<BITS, LIMBS>

Available on crate feature alloy-rlp only.
source§

fn decode(buf: &mut &[u8]) -> Result<Self, Error>

Decodes the blob into the appropriate type. buf must be advanced past the decoded object.
source§

impl<const BITS: usize, const LIMBS: usize> Decodable for Uint<BITS, LIMBS>

Available on crate feature rlp only.

Allows a Uint to be deserialized from RLP.

See https://eth.wiki/en/fundamentals/rlp

source§

fn decode(s: &Rlp<'_>) -> Result<Self, DecoderError>

Decode a value from RLP bytes
source§

impl<const BITS: usize, const LIMBS: usize> Decodable for Uint<BITS, LIMBS>

Available on crate feature fastrlp only.
source§

fn decode(buf: &mut &[u8]) -> Result<Self, DecodeError>

source§

impl<'a, const BITS: usize, const LIMBS: usize, DB: Database> Decode<'a, DB> for Uint<BITS, LIMBS>
where Vec<u8>: Decode<'a, DB>,

Available on crate feature sqlx only.
source§

fn decode(value: <DB as HasValueRef<'a>>::ValueRef) -> Result<Self, BoxDynError>

Decode a new value of this type using a raw value from the database.
source§

impl<const BITS: usize, const LIMBS: usize> Decode for Uint<BITS, LIMBS>

Available on crate feature ssz only.
source§

fn is_ssz_fixed_len() -> bool

Returns true if this object has a fixed-length. Read more
source§

fn ssz_fixed_len() -> usize

The number of bytes this object occupies in the fixed-length portion of the SSZ bytes. Read more
source§

fn from_ssz_bytes(bytes: &[u8]) -> Result<Self, DecodeError>

Attempts to decode Self from bytes, returning a DecodeError on failure. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Decode for Uint<BITS, LIMBS>

Available on crate feature parity-scale-codec only.
source§

fn decode<I: Input>(input: &mut I) -> Result<Self, Error>

Attempt to deserialise the value from input.
source§

fn decode_into<I>( input: &mut I, dst: &mut MaybeUninit<Self> ) -> Result<DecodeFinished, Error>
where I: Input,

Attempt to deserialize the value from input into a pre-allocated piece of memory. Read more
source§

fn skip<I>(input: &mut I) -> Result<(), Error>
where I: Input,

Attempt to skip the encoded value from input. Read more
source§

fn encoded_fixed_size() -> Option<usize>

Returns the fixed encoded size of the type. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Default for Uint<BITS, LIMBS>

source§

fn default() -> Self

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

impl<'de, const BITS: usize, const LIMBS: usize> Deserialize<'de> for Uint<BITS, LIMBS>

Available on crate feature serde only.

Deserialize human readable hex strings or byte arrays into hashes. Hex strings can be upper/lower/mixed case, have an optional 0x prefix, and can be any length. They are interpreted big-endian.

source§

fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>

Deserialize this value from the given Serde deserializer. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Display for Uint<BITS, LIMBS>

Available on crate feature alloc only.
source§

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

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

impl<const BITS: usize, const LIMBS: usize> Distribution<Uint<BITS, LIMBS>> for Standard

Available on crate feature rand only.
source§

fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Uint<BITS, LIMBS>

Generate a random value of T, using rng as the source of randomness.
source§

fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
where R: Rng, Self: Sized,

Create an iterator that generates random values of T, using rng as the source of randomness. Read more
source§

fn map<F, S>(self, func: F) -> DistMap<Self, F, T, S>
where F: Fn(T) -> S, Self: Sized,

Create a distribution of values of ‘S’ by mapping the output of Self through the closure F Read more
source§

impl<const BITS: usize, const LIMBS: usize> Div<&Uint<BITS, LIMBS>> for &Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

The resulting type after applying the / operator.
source§

fn div(self, rhs: &Uint<BITS, LIMBS>) -> Self::Output

Performs the / operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Div<&Uint<BITS, LIMBS>> for Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

The resulting type after applying the / operator.
source§

fn div(self, rhs: &Uint<BITS, LIMBS>) -> Self::Output

Performs the / operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Div<Uint<BITS, LIMBS>> for &Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

The resulting type after applying the / operator.
source§

fn div(self, rhs: Uint<BITS, LIMBS>) -> Self::Output

Performs the / operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Div for Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

The resulting type after applying the / operator.
source§

fn div(self, rhs: Uint<BITS, LIMBS>) -> Self::Output

Performs the / operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> DivAssign<&Uint<BITS, LIMBS>> for Uint<BITS, LIMBS>

source§

fn div_assign(&mut self, rhs: &Uint<BITS, LIMBS>)

Performs the /= operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> DivAssign for Uint<BITS, LIMBS>

source§

fn div_assign(&mut self, rhs: Uint<BITS, LIMBS>)

Performs the /= operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Encodable for Uint<BITS, LIMBS>

Available on crate feature rlp only.

Allows a Uint to be serialized as RLP.

See https://eth.wiki/en/fundamentals/rlp

source§

fn rlp_append(&self, s: &mut RlpStream)

Append a value to the stream
source§

fn rlp_bytes(&self) -> BytesMut

Get rlp-encoded bytes for this instance
source§

impl<const BITS: usize, const LIMBS: usize> Encodable for Uint<BITS, LIMBS>

Available on crate feature fastrlp only.
source§

fn length(&self) -> usize

source§

fn encode(&self, out: &mut dyn BufMut)

source§

impl<const BITS: usize, const LIMBS: usize> Encodable for Uint<BITS, LIMBS>

Available on crate feature alloy-rlp only.
source§

fn length(&self) -> usize

Returns the length of the encoding of this type in bytes. Read more
source§

fn encode(&self, out: &mut dyn BufMut)

Encodes the type into the out buffer.
source§

impl<'a, const BITS: usize, const LIMBS: usize, DB: Database> Encode<'a, DB> for Uint<BITS, LIMBS>
where Vec<u8>: Encode<'a, DB>,

Available on crate feature sqlx only.
source§

fn encode_by_ref( &self, buf: &mut <DB as HasArguments<'a>>::ArgumentBuffer ) -> IsNull

Writes the value of self into buf without moving self. Read more
source§

fn encode(self, buf: &mut <DB as HasArguments<'q>>::ArgumentBuffer) -> IsNull
where Self: Sized,

Writes the value of self into buf in the expected format for the database.
source§

fn produces(&self) -> Option<<DB as Database>::TypeInfo>

source§

fn size_hint(&self) -> usize

source§

impl<const BITS: usize, const LIMBS: usize> Encode for Uint<BITS, LIMBS>

Available on crate feature parity-scale-codec only.
source§

fn size_hint(&self) -> usize

u32 prefix for compact encoding + bytes needed for LE bytes representation

source§

fn using_encoded<R, F: FnOnce(&[u8]) -> R>(&self, f: F) -> R

Convert self to a slice and then invoke the given closure with it.
source§

fn encode_to<T>(&self, dest: &mut T)
where T: Output + ?Sized,

Convert self to a slice and append it to the destination.
source§

fn encode(&self) -> Vec<u8>

Convert self to an owned vector.
source§

fn encoded_size(&self) -> usize

Calculates the encoded size. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Encode for Uint<BITS, LIMBS>

Available on crate feature ssz only.
source§

fn is_ssz_fixed_len() -> bool

Returns true if this object has a fixed-length. Read more
source§

fn ssz_fixed_len() -> usize

The number of bytes this object occupies in the fixed-length portion of the SSZ bytes. Read more
source§

fn ssz_bytes_len(&self) -> usize

Returns the size (in bytes) when self is serialized. Read more
source§

fn ssz_append(&self, buf: &mut Vec<u8>)

Append the encoding self to buf. Read more
source§

fn as_ssz_bytes(&self) -> Vec<u8>

Returns the full-form encoding of this object. Read more
source§

impl<'a, const BITS: usize, const LIMBS: usize> EncodeAsRef<'a, Uint<BITS, LIMBS>> for CompactUint<BITS, LIMBS>

Available on crate feature parity-scale-codec only.
§

type RefType = CompactRefUint<'a, BITS, LIMBS>

The reference type that is used for encoding.
source§

impl<const BITS: usize, const LIMBS: usize> Euclid for Uint<BITS, LIMBS>

Available on crate feature num-traits only.
source§

fn div_euclid(&self, v: &Self) -> Self

Calculates Euclidean division, the matching method for rem_euclid. Read more
source§

fn rem_euclid(&self, v: &Self) -> Self

Calculates the least nonnegative remainder of self (mod v). Read more
source§

fn div_rem_euclid(&self, v: &Self) -> (Self, Self)

Returns both the quotient and remainder from Euclidean division. Read more
source§

impl<const BITS: usize, const LIMBS: usize> From<&BigInt<LIMBS>> for Uint<BITS, LIMBS>

Available on crate feature ark-ff-04 only.
source§

fn from(value: &BigInt<LIMBS>) -> Self

Converts to this type from the input type.
source§

impl From<&BigInteger128> for Uint<128, 2>

Available on crate feature ark-ff only.
source§

fn from(value: &BigInteger128) -> Self

Converts to this type from the input type.
source§

impl From<&BigInteger256> for Uint<256, 4>

Available on crate feature ark-ff only.
source§

fn from(value: &BigInteger256) -> Self

Converts to this type from the input type.
source§

impl From<&BigInteger320> for Uint<320, 5>

Available on crate feature ark-ff only.
source§

fn from(value: &BigInteger320) -> Self

Converts to this type from the input type.
source§

impl From<&BigInteger384> for Uint<384, 6>

Available on crate feature ark-ff only.
source§

fn from(value: &BigInteger384) -> Self

Converts to this type from the input type.
source§

impl From<&BigInteger448> for Uint<448, 7>

Available on crate feature ark-ff only.
source§

fn from(value: &BigInteger448) -> Self

Converts to this type from the input type.
source§

impl From<&BigInteger64> for Uint<64, 1>

Available on crate feature ark-ff only.
source§

fn from(value: &BigInteger64) -> Self

Converts to this type from the input type.
source§

impl From<&BigInteger768> for Uint<768, 12>

Available on crate feature ark-ff only.
source§

fn from(value: &BigInteger768) -> Self

Converts to this type from the input type.
source§

impl From<&BigInteger832> for Uint<832, 13>

Available on crate feature ark-ff only.
source§

fn from(value: &BigInteger832) -> Self

Converts to this type from the input type.
source§

impl<P: FpConfig<LIMBS>, const BITS: usize, const LIMBS: usize> From<&Fp<P, LIMBS>> for Uint<BITS, LIMBS>

Available on crate feature ark-ff-04 only.
source§

fn from(value: &Fp<P, LIMBS>) -> Self

Converts to this type from the input type.
source§

impl<P: Fp256Parameters> From<&Fp256<P>> for Uint<256, 4>

Available on crate feature ark-ff only.
source§

fn from(value: &Fp256<P>) -> Self

Converts to this type from the input type.
source§

impl<P: Fp320Parameters> From<&Fp320<P>> for Uint<320, 5>

Available on crate feature ark-ff only.
source§

fn from(value: &Fp320<P>) -> Self

Converts to this type from the input type.
source§

impl<P: Fp384Parameters> From<&Fp384<P>> for Uint<384, 6>

Available on crate feature ark-ff only.
source§

fn from(value: &Fp384<P>) -> Self

Converts to this type from the input type.
source§

impl<P: Fp448Parameters> From<&Fp448<P>> for Uint<448, 7>

Available on crate feature ark-ff only.
source§

fn from(value: &Fp448<P>) -> Self

Converts to this type from the input type.
source§

impl<P: Fp64Parameters> From<&Fp64<P>> for Uint<64, 1>

Available on crate feature ark-ff only.
source§

fn from(value: &Fp64<P>) -> Self

Converts to this type from the input type.
source§

impl<P: Fp768Parameters> From<&Fp768<P>> for Uint<768, 12>

Available on crate feature ark-ff only.
source§

fn from(value: &Fp768<P>) -> Self

Converts to this type from the input type.
source§

impl<P: Fp832Parameters> From<&Fp832<P>> for Uint<832, 13>

Available on crate feature ark-ff only.
source§

fn from(value: &Fp832<P>) -> Self

Converts to this type from the input type.
source§

impl From<&Uint<128, 2>> for BigInteger128

Available on crate feature ark-ff only.
source§

fn from(value: &Uint<128, 2>) -> Self

Converts to this type from the input type.
source§

impl From<&Uint<256, 4>> for BigInteger256

Available on crate feature ark-ff only.
source§

fn from(value: &Uint<256, 4>) -> Self

Converts to this type from the input type.
source§

impl From<&Uint<320, 5>> for BigInteger320

Available on crate feature ark-ff only.
source§

fn from(value: &Uint<320, 5>) -> Self

Converts to this type from the input type.
source§

impl From<&Uint<384, 6>> for BigInteger384

Available on crate feature ark-ff only.
source§

fn from(value: &Uint<384, 6>) -> Self

Converts to this type from the input type.
source§

impl From<&Uint<448, 7>> for BigInteger448

Available on crate feature ark-ff only.
source§

fn from(value: &Uint<448, 7>) -> Self

Converts to this type from the input type.
source§

impl From<&Uint<64, 1>> for BigInteger64

Available on crate feature ark-ff only.
source§

fn from(value: &Uint<64, 1>) -> Self

Converts to this type from the input type.
source§

impl From<&Uint<768, 12>> for BigInteger768

Available on crate feature ark-ff only.
source§

fn from(value: &Uint<768, 12>) -> Self

Converts to this type from the input type.
source§

impl From<&Uint<832, 13>> for BigInteger832

Available on crate feature ark-ff only.
source§

fn from(value: &Uint<832, 13>) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize, const LIMBS: usize> From<&Uint<BITS, LIMBS>> for BN

Available on crate feature bn-rs only.
source§

fn from(value: &Uint<BITS, LIMBS>) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize, const LIMBS: usize> From<&Uint<BITS, LIMBS>> for BigInt

Available on crate feature num-bigint only.
source§

fn from(value: &Uint<BITS, LIMBS>) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize, const LIMBS: usize> From<&Uint<BITS, LIMBS>> for BigInt<LIMBS>

Available on crate feature ark-ff-04 only.
source§

fn from(value: &Uint<BITS, LIMBS>) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize, const LIMBS: usize> From<&Uint<BITS, LIMBS>> for BigNumber

Available on crate feature bn-rs only.
source§

fn from(value: &Uint<BITS, LIMBS>) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize, const LIMBS: usize> From<&Uint<BITS, LIMBS>> for BigUint

Available on crate feature num-bigint only.
source§

fn from(value: &Uint<BITS, LIMBS>) -> Self

Converts to this type from the input type.
source§

impl<'a, const BITS: usize, const LIMBS: usize> From<&'a Uint<BITS, LIMBS>> for CompactRefUint<'a, BITS, LIMBS>

Available on crate feature parity-scale-codec only.
source§

fn from(v: &'a Uint<BITS, LIMBS>) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize, const LIMBS: usize> From<&Uint<BITS, LIMBS>> for f32

Available on crate feature std only.
source§

fn from(value: &Uint<BITS, LIMBS>) -> Self

Approximate single precision float.

Returns f32::INFINITY if the value is too large to represent.

source§

impl<const BITS: usize, const LIMBS: usize> From<&Uint<BITS, LIMBS>> for f64

Available on crate feature std only.
source§

fn from(value: &Uint<BITS, LIMBS>) -> Self

Approximate double precision float.

Returns f64::INFINITY if the value is too large to represent.

source§

impl<const BITS: usize, const LIMBS: usize> From<BigInt<LIMBS>> for Uint<BITS, LIMBS>

Available on crate feature ark-ff-04 only.
source§

fn from(value: BigInt<LIMBS>) -> Self

Converts to this type from the input type.
source§

impl From<BigInteger128> for Uint<128, 2>

Available on crate feature ark-ff only.
source§

fn from(value: BigInteger128) -> Self

Converts to this type from the input type.
source§

impl From<BigInteger256> for Uint<256, 4>

Available on crate feature ark-ff only.
source§

fn from(value: BigInteger256) -> Self

Converts to this type from the input type.
source§

impl From<BigInteger320> for Uint<320, 5>

Available on crate feature ark-ff only.
source§

fn from(value: BigInteger320) -> Self

Converts to this type from the input type.
source§

impl From<BigInteger384> for Uint<384, 6>

Available on crate feature ark-ff only.
source§

fn from(value: BigInteger384) -> Self

Converts to this type from the input type.
source§

impl From<BigInteger448> for Uint<448, 7>

Available on crate feature ark-ff only.
source§

fn from(value: BigInteger448) -> Self

Converts to this type from the input type.
source§

impl From<BigInteger64> for Uint<64, 1>

Available on crate feature ark-ff only.
source§

fn from(value: BigInteger64) -> Self

Converts to this type from the input type.
source§

impl From<BigInteger768> for Uint<768, 12>

Available on crate feature ark-ff only.
source§

fn from(value: BigInteger768) -> Self

Converts to this type from the input type.
source§

impl From<BigInteger832> for Uint<832, 13>

Available on crate feature ark-ff only.
source§

fn from(value: BigInteger832) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize, const LIMBS: usize> From<Bits<BITS, LIMBS>> for Uint<BITS, LIMBS>

source§

fn from(value: Bits<BITS, LIMBS>) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize, const LIMBS: usize> From<CompactUint<BITS, LIMBS>> for Uint<BITS, LIMBS>

Available on crate feature parity-scale-codec only.
source§

fn from(v: CompactUint<BITS, LIMBS>) -> Self

Converts to this type from the input type.
source§

impl<P: FpConfig<LIMBS>, const BITS: usize, const LIMBS: usize> From<Fp<P, LIMBS>> for Uint<BITS, LIMBS>

Available on crate feature ark-ff-04 only.
source§

fn from(value: Fp<P, LIMBS>) -> Self

Converts to this type from the input type.
source§

impl<P: Fp256Parameters> From<Fp256<P>> for Uint<256, 4>

Available on crate feature ark-ff only.
source§

fn from(value: Fp256<P>) -> Self

Converts to this type from the input type.
source§

impl<P: Fp320Parameters> From<Fp320<P>> for Uint<320, 5>

Available on crate feature ark-ff only.
source§

fn from(value: Fp320<P>) -> Self

Converts to this type from the input type.
source§

impl<P: Fp384Parameters> From<Fp384<P>> for Uint<384, 6>

Available on crate feature ark-ff only.
source§

fn from(value: Fp384<P>) -> Self

Converts to this type from the input type.
source§

impl<P: Fp448Parameters> From<Fp448<P>> for Uint<448, 7>

Available on crate feature ark-ff only.
source§

fn from(value: Fp448<P>) -> Self

Converts to this type from the input type.
source§

impl<P: Fp64Parameters> From<Fp64<P>> for Uint<64, 1>

Available on crate feature ark-ff only.
source§

fn from(value: Fp64<P>) -> Self

Converts to this type from the input type.
source§

impl<P: Fp768Parameters> From<Fp768<P>> for Uint<768, 12>

Available on crate feature ark-ff only.
source§

fn from(value: Fp768<P>) -> Self

Converts to this type from the input type.
source§

impl<P: Fp832Parameters> From<Fp832<P>> for Uint<832, 13>

Available on crate feature ark-ff only.
source§

fn from(value: Fp832<P>) -> Self

Converts to this type from the input type.
source§

impl From<Uint<128, 2>> for BigInteger128

Available on crate feature ark-ff only.
source§

fn from(value: Uint<128, 2>) -> Self

Converts to this type from the input type.
source§

impl From<Uint<128, 2>> for U128

Available on crate feature primitive-types only.
source§

fn from(value: U128) -> Self

Converts to this type from the input type.
source§

impl From<Uint<256, 4>> for BigInteger256

Available on crate feature ark-ff only.
source§

fn from(value: Uint<256, 4>) -> Self

Converts to this type from the input type.
source§

impl From<Uint<256, 4>> for U256

Available on crate feature primitive-types only.
source§

fn from(value: U256) -> Self

Converts to this type from the input type.
source§

impl From<Uint<320, 5>> for BigInteger320

Available on crate feature ark-ff only.
source§

fn from(value: Uint<320, 5>) -> Self

Converts to this type from the input type.
source§

impl From<Uint<384, 6>> for BigInteger384

Available on crate feature ark-ff only.
source§

fn from(value: Uint<384, 6>) -> Self

Converts to this type from the input type.
source§

impl From<Uint<448, 7>> for BigInteger448

Available on crate feature ark-ff only.
source§

fn from(value: Uint<448, 7>) -> Self

Converts to this type from the input type.
source§

impl From<Uint<512, 8>> for U512

Available on crate feature primitive-types only.
source§

fn from(value: U512) -> Self

Converts to this type from the input type.
source§

impl From<Uint<64, 1>> for BigInteger64

Available on crate feature ark-ff only.
source§

fn from(value: Uint<64, 1>) -> Self

Converts to this type from the input type.
source§

impl From<Uint<768, 12>> for BigInteger768

Available on crate feature ark-ff only.
source§

fn from(value: Uint<768, 12>) -> Self

Converts to this type from the input type.
source§

impl From<Uint<832, 13>> for BigInteger832

Available on crate feature ark-ff only.
source§

fn from(value: Uint<832, 13>) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize, const LIMBS: usize> From<Uint<BITS, LIMBS>> for BN

Available on crate feature bn-rs only.
source§

fn from(value: Uint<BITS, LIMBS>) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize, const LIMBS: usize> From<Uint<BITS, LIMBS>> for BigInt

Available on crate feature num-bigint only.
source§

fn from(value: Uint<BITS, LIMBS>) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize, const LIMBS: usize> From<Uint<BITS, LIMBS>> for BigInt<LIMBS>

Available on crate feature ark-ff-04 only.
source§

fn from(value: Uint<BITS, LIMBS>) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize, const LIMBS: usize> From<Uint<BITS, LIMBS>> for BigNumber

Available on crate feature bn-rs only.
source§

fn from(value: Uint<BITS, LIMBS>) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize, const LIMBS: usize> From<Uint<BITS, LIMBS>> for BigUint

Available on crate feature num-bigint only.
source§

fn from(value: Uint<BITS, LIMBS>) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize, const LIMBS: usize> From<Uint<BITS, LIMBS>> for Bits<BITS, LIMBS>

source§

fn from(value: Uint<BITS, LIMBS>) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize, const LIMBS: usize> From<Uint<BITS, LIMBS>> for CompactUint<BITS, LIMBS>

Available on crate feature parity-scale-codec only.
source§

fn from(v: Uint<BITS, LIMBS>) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize, const LIMBS: usize> From<Uint<BITS, LIMBS>> for f32

Available on crate feature std only.
source§

fn from(value: Uint<BITS, LIMBS>) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize, const LIMBS: usize> From<Uint<BITS, LIMBS>> for f64

Available on crate feature std only.
source§

fn from(value: Uint<BITS, LIMBS>) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize, const LIMBS: usize> FromBytes for Uint<BITS, LIMBS>

Available on crate feature num-traits only.
§

type Bytes = [u8]

source§

fn from_le_bytes(bytes: &[u8]) -> Self

Create a number from its representation as a byte array in little endian. Read more
source§

fn from_be_bytes(bytes: &[u8]) -> Self

Create a number from its representation as a byte array in big endian. Read more
source§

fn from_ne_bytes(bytes: &Self::Bytes) -> Self

Create a number from its memory representation as a byte array in native endianness. Read more
source§

impl<const BITS: usize, const LIMBS: usize> FromPrimitive for Uint<BITS, LIMBS>

Available on crate feature num-traits only.
source§

fn from_i64(n: i64) -> Option<Self>

Converts an i64 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
source§

fn from_u64(n: u64) -> Option<Self>

Converts an u64 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
source§

fn from_i128(n: i128) -> Option<Self>

Converts an i128 to return an optional value of this type. If the value cannot be represented by this type, then None is returned. Read more
source§

fn from_u128(n: u128) -> Option<Self>

Converts an u128 to return an optional value of this type. If the value cannot be represented by this type, then None is returned. Read more
source§

fn from_isize(n: isize) -> Option<Self>

Converts an isize to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
source§

fn from_i8(n: i8) -> Option<Self>

Converts an i8 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
source§

fn from_i16(n: i16) -> Option<Self>

Converts an i16 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
source§

fn from_i32(n: i32) -> Option<Self>

Converts an i32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
source§

fn from_usize(n: usize) -> Option<Self>

Converts a usize to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
source§

fn from_u8(n: u8) -> Option<Self>

Converts an u8 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
source§

fn from_u16(n: u16) -> Option<Self>

Converts an u16 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
source§

fn from_u32(n: u32) -> Option<Self>

Converts an u32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
source§

fn from_f32(n: f32) -> Option<Self>

Converts a f32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
source§

fn from_f64(n: f64) -> Option<Self>

Converts a f64 to return an optional value of this type. If the value cannot be represented by this type, then None is returned. Read more
source§

impl<'source, const BITS: usize, const LIMBS: usize> FromPyObject<'source> for Uint<BITS, LIMBS>

Available on crate feature pyo3 only.
source§

fn extract(ob: &'source PyAny) -> PyResult<Self>

Extracts Self from the source PyObject.
source§

impl<'a, const BITS: usize, const LIMBS: usize> FromSql<'a> for Uint<BITS, LIMBS>

Available on crate feature postgres only.

Convert from Postgres types.

See ToSql for details.

source§

fn accepts(ty: &Type) -> bool

Determines if a value of this type can be created from the specified Postgres Type.
source§

fn from_sql( ty: &Type, raw: &'a [u8] ) -> Result<Self, Box<dyn Error + Sync + Send>>

Creates a new value of this type from a buffer of data of the specified Postgres Type in its binary format. Read more
source§

fn from_sql_null(ty: &Type) -> Result<Self, Box<dyn Error + Send + Sync>>

Creates a new value of this type from a NULL SQL value. Read more
source§

fn from_sql_nullable( ty: &Type, raw: Option<&'a [u8]> ) -> Result<Self, Box<dyn Error + Send + Sync>>

A convenience function that delegates to from_sql and from_sql_null depending on the value of raw.
source§

impl<const BITS: usize, const LIMBS: usize> FromStr for Uint<BITS, LIMBS>

§

type Err = ParseError

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

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

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

impl<const BITS: usize, const LIMBS: usize> HasCompact for Uint<BITS, LIMBS>

Available on crate feature parity-scale-codec only.
§

type Type = CompactUint<BITS, LIMBS>

The compact type; this can be
source§

impl<const BITS: usize, const LIMBS: usize> Hash for Uint<BITS, LIMBS>

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<const BITS: usize, const LIMBS: usize> IntoPy<Py<PyAny>> for Uint<BITS, LIMBS>

Available on crate feature pyo3 only.
source§

fn into_py(self, py: Python<'_>) -> PyObject

Performs the conversion.
source§

impl<const BITS: usize, const LIMBS: usize> Inv for Uint<BITS, LIMBS>

Available on crate feature num-traits only.
§

type Output = Option<Uint<BITS, LIMBS>>

The result after applying the operator.
source§

fn inv(self) -> Self::Output

Returns the multiplicative inverse of self. Read more
source§

impl<const BITS: usize, const LIMBS: usize> LowerHex for Uint<BITS, LIMBS>

Available on crate feature alloc only.
source§

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

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

impl<const BITS: usize, const LIMBS: usize> MaxEncodedLen for Uint<BITS, LIMBS>

Available on crate feature parity-scale-codec only.
source§

fn max_encoded_len() -> usize

Upper bound, in bytes, of the maximum encoded size of this item.
source§

impl<const BITS: usize, const LIMBS: usize> MaxEncodedLenAssoc for Uint<BITS, LIMBS>

Available on crate feature alloy-rlp only.
source§

const LEN: usize = _

The maximum length.
source§

impl<const BITS: usize, const LIMBS: usize> Mul<&Uint<BITS, LIMBS>> for &Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &Uint<BITS, LIMBS>) -> Self::Output

Performs the * operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Mul<&Uint<BITS, LIMBS>> for Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &Uint<BITS, LIMBS>) -> Self::Output

Performs the * operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Mul<Uint<BITS, LIMBS>> for &Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Uint<BITS, LIMBS>) -> Self::Output

Performs the * operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Mul for Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Uint<BITS, LIMBS>) -> Self::Output

Performs the * operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> MulAdd for Uint<BITS, LIMBS>

Available on crate feature num-traits only.
§

type Output = Uint<BITS, LIMBS>

The resulting type after applying the fused multiply-add.
source§

fn mul_add(self, a: Self, b: Self) -> Self::Output

Performs the fused multiply-add operation (self * a) + b
source§

impl<const BITS: usize, const LIMBS: usize> MulAddAssign for Uint<BITS, LIMBS>

Available on crate feature num-traits only.
source§

fn mul_add_assign(&mut self, a: Self, b: Self)

Performs the fused multiply-add assignment operation *self = (*self * a) + b
source§

impl<const BITS: usize, const LIMBS: usize> MulAssign<&Uint<BITS, LIMBS>> for Uint<BITS, LIMBS>

source§

fn mul_assign(&mut self, rhs: &Uint<BITS, LIMBS>)

Performs the *= operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> MulAssign for Uint<BITS, LIMBS>

source§

fn mul_assign(&mut self, rhs: Uint<BITS, LIMBS>)

Performs the *= operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Neg for &Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

The resulting type after applying the - operator.
source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Neg for Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

The resulting type after applying the - operator.
source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Not for &Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

The resulting type after applying the ! operator.
source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Not for Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

The resulting type after applying the ! operator.
source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Num for Uint<BITS, LIMBS>

Available on crate feature num-traits only.
§

type FromStrRadixErr = ParseError

source§

fn from_str_radix(str: &str, radix: u32) -> Result<Self, Self::FromStrRadixErr>

Convert from a string and radix (typically 2..=36). Read more
source§

impl<const BITS: usize, const LIMBS: usize> NumCast for Uint<BITS, LIMBS>

Available on crate feature num-traits only.
source§

fn from<T: ToPrimitive>(n: T) -> Option<Self>

Creates a number from another value that can be converted into a primitive via the ToPrimitive trait. If the source value cannot be represented by the target type, then None is returned. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Octal for Uint<BITS, LIMBS>

Available on crate feature alloc only.
source§

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

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

impl<const BITS: usize, const LIMBS: usize> One for Uint<BITS, LIMBS>

Available on crate feature num-traits only.
source§

fn one() -> Self

Returns the multiplicative identity element of Self, 1. Read more
source§

fn set_one(&mut self)

Sets self to the multiplicative identity element of Self, 1.
source§

fn is_one(&self) -> bool
where Self: PartialEq,

Returns true if self is equal to the multiplicative identity. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Ord for Uint<BITS, LIMBS>

source§

fn cmp(&self, rhs: &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 + PartialOrd,

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

impl<const BITS: usize, const LIMBS: usize> OverflowingAdd for Uint<BITS, LIMBS>

Available on crate feature num-traits only.
source§

fn overflowing_add(&self, v: &Self) -> (Self, bool)

Returns a tuple of the sum along with a boolean indicating whether an arithmetic overflow would occur. If an overflow would have occurred then the wrapped value is returned.
source§

impl<const BITS: usize, const LIMBS: usize> OverflowingMul for Uint<BITS, LIMBS>

Available on crate feature num-traits only.
source§

fn overflowing_mul(&self, v: &Self) -> (Self, bool)

Returns a tuple of the product along with a boolean indicating whether an arithmetic overflow would occur. If an overflow would have occurred then the wrapped value is returned.
source§

impl<const BITS: usize, const LIMBS: usize> OverflowingSub for Uint<BITS, LIMBS>

Available on crate feature num-traits only.
source§

fn overflowing_sub(&self, v: &Self) -> (Self, bool)

Returns a tuple of the difference along with a boolean indicating whether an arithmetic overflow would occur. If an overflow would have occurred then the wrapped value is returned.
source§

impl<const BITS: usize, const LIMBS: usize> PartialEq for Uint<BITS, LIMBS>

source§

fn eq(&self, other: &Uint<BITS, LIMBS>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<const BITS: usize, const LIMBS: usize> PartialOrd for Uint<BITS, LIMBS>

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

This method 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

This method 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

This method 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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Pow<Uint<BITS, LIMBS>> for Uint<BITS, LIMBS>

Available on crate feature num-traits only.
§

type Output = Uint<BITS, LIMBS>

The result after applying the operator.
source§

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

Returns self to the power rhs. Read more
source§

impl<const BITS: usize, const LIMBS: usize> PrimInt for Uint<BITS, LIMBS>

Available on crate feature num-traits only.
source§

fn swap_bytes(self) -> Self

Note: This is not well-defined when BITS % 8 != 0.

source§

fn count_ones(self) -> u32

Returns the number of ones in the binary representation of self. Read more
source§

fn count_zeros(self) -> u32

Returns the number of zeros in the binary representation of self. Read more
source§

fn leading_zeros(self) -> u32

Returns the number of leading zeros in the binary representation of self. Read more
source§

fn leading_ones(self) -> u32

Returns the number of leading ones in the binary representation of self. Read more
source§

fn trailing_zeros(self) -> u32

Returns the number of trailing zeros in the binary representation of self. Read more
source§

fn trailing_ones(self) -> u32

Returns the number of trailing ones in the binary representation of self. Read more
source§

fn rotate_left(self, n: u32) -> Self

Shifts the bits to the left by a specified amount, n, wrapping the truncated bits to the end of the resulting integer. Read more
source§

fn rotate_right(self, n: u32) -> Self

Shifts the bits to the right by a specified amount, n, wrapping the truncated bits to the beginning of the resulting integer. Read more
source§

fn signed_shl(self, n: u32) -> Self

Shifts the bits to the left by a specified amount, n, filling zeros in the least significant bits. Read more
source§

fn signed_shr(self, n: u32) -> Self

Shifts the bits to the right by a specified amount, n, copying the “sign bit” in the most significant bits even for unsigned types. Read more
source§

fn unsigned_shl(self, n: u32) -> Self

Shifts the bits to the left by a specified amount, n, filling zeros in the least significant bits. Read more
source§

fn unsigned_shr(self, n: u32) -> Self

Shifts the bits to the right by a specified amount, n, filling zeros in the most significant bits. Read more
source§

fn reverse_bits(self) -> Self

Reverses the order of bits in the integer. Read more
source§

fn from_be(x: Self) -> Self

Convert an integer from big endian to the target’s endianness. Read more
source§

fn from_le(x: Self) -> Self

Convert an integer from little endian to the target’s endianness. Read more
source§

fn to_be(self) -> Self

Convert self to big endian from the target’s endianness. Read more
source§

fn to_le(self) -> Self

Convert self to little endian from the target’s endianness. Read more
source§

fn pow(self, exp: u32) -> Self

Raises self to the power of exp, using exponentiation by squaring. Read more
source§

impl<'a, const BITS: usize, const LIMBS: usize> Product<&'a Uint<BITS, LIMBS>> for Uint<BITS, LIMBS>

source§

fn product<I>(iter: I) -> Self
where I: Iterator<Item = &'a Self>,

Method which takes an iterator and generates Self from the elements by multiplying the items.
source§

impl<const BITS: usize, const LIMBS: usize> Product for Uint<BITS, LIMBS>

source§

fn product<I>(iter: I) -> Self
where I: Iterator<Item = Self>,

Method which takes an iterator and generates Self from the elements by multiplying the items.
source§

impl<const BITS: usize, const LIMBS: usize> Rem<&Uint<BITS, LIMBS>> for &Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

The resulting type after applying the % operator.
source§

fn rem(self, rhs: &Uint<BITS, LIMBS>) -> Self::Output

Performs the % operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Rem<&Uint<BITS, LIMBS>> for Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

The resulting type after applying the % operator.
source§

fn rem(self, rhs: &Uint<BITS, LIMBS>) -> Self::Output

Performs the % operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Rem<Uint<BITS, LIMBS>> for &Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

The resulting type after applying the % operator.
source§

fn rem(self, rhs: Uint<BITS, LIMBS>) -> Self::Output

Performs the % operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Rem for Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

The resulting type after applying the % operator.
source§

fn rem(self, rhs: Uint<BITS, LIMBS>) -> Self::Output

Performs the % operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> RemAssign<&Uint<BITS, LIMBS>> for Uint<BITS, LIMBS>

source§

fn rem_assign(&mut self, rhs: &Uint<BITS, LIMBS>)

Performs the %= operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> RemAssign for Uint<BITS, LIMBS>

source§

fn rem_assign(&mut self, rhs: Uint<BITS, LIMBS>)

Performs the %= operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Saturating for Uint<BITS, LIMBS>

Available on crate feature num-traits only.
source§

fn saturating_add(self, v: Self) -> Self

Saturating addition operator. Returns a+b, saturating at the numeric bounds instead of overflowing.
source§

fn saturating_sub(self, v: Self) -> Self

Saturating subtraction operator. Returns a-b, saturating at the numeric bounds instead of overflowing.
source§

impl<const BITS: usize, const LIMBS: usize> SaturatingAdd for Uint<BITS, LIMBS>

Available on crate feature num-traits only.
source§

fn saturating_add(&self, v: &Self) -> Self

Saturating addition. Computes self + other, saturating at the relevant high or low boundary of the type.
source§

impl<const BITS: usize, const LIMBS: usize> SaturatingMul for Uint<BITS, LIMBS>

Available on crate feature num-traits only.
source§

fn saturating_mul(&self, v: &Self) -> Self

Saturating multiplication. Computes self * other, saturating at the relevant high or low boundary of the type.
source§

impl<const BITS: usize, const LIMBS: usize> SaturatingSub for Uint<BITS, LIMBS>

Available on crate feature num-traits only.
source§

fn saturating_sub(&self, v: &Self) -> Self

Saturating subtraction. Computes self - other, saturating at the relevant high or low boundary of the type.
source§

impl<const BITS: usize, const LIMBS: usize> Serialize for Uint<BITS, LIMBS>

Available on crate feature serde only.

Serialize a Uint value.

For human readable formats a 0x prefixed lower case hex string is used. For binary formats a byte array is used. Leading zeros are included.

source§

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

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

impl<const BITS: usize, const LIMBS: usize> Shl<&Uint<BITS, LIMBS>> for Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

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

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

Performs the << operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Shl<&i16> for Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

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

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

Performs the << operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Shl<&i32> for Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

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

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

Performs the << operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Shl<&i64> for Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

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

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

Performs the << operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Shl<&i8> for Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

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

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

Performs the << operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Shl<&isize> for Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

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

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

Performs the << operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Shl<&u16> for Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

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

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

Performs the << operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Shl<&u32> for Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

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

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

Performs the << operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Shl<&u64> for Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

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

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

Performs the << operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Shl<&u8> for Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

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

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

Performs the << operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Shl<&usize> for Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

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

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

Performs the << operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Shl<i16> for Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

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

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

Performs the << operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Shl<i32> for Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

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

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

Performs the << operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Shl<i64> for Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

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

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

Performs the << operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Shl<i8> for Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

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

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

Performs the << operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Shl<isize> for Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

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

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

Performs the << operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Shl<u16> for Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

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

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

Performs the << operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Shl<u32> for Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

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

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

Performs the << operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Shl<u64> for Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

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

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

Performs the << operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Shl<u8> for Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

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

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

Performs the << operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Shl<usize> for Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

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

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

Performs the << operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Shl for Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

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

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

Performs the << operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> ShlAssign<&Uint<BITS, LIMBS>> for Uint<BITS, LIMBS>

source§

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

Performs the <<= operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> ShlAssign<&i16> for Uint<BITS, LIMBS>

source§

fn shl_assign(&mut self, rhs: &i16)

Performs the <<= operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> ShlAssign<&i32> for Uint<BITS, LIMBS>

source§

fn shl_assign(&mut self, rhs: &i32)

Performs the <<= operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> ShlAssign<&i64> for Uint<BITS, LIMBS>

source§

fn shl_assign(&mut self, rhs: &i64)

Performs the <<= operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> ShlAssign<&i8> for Uint<BITS, LIMBS>

source§

fn shl_assign(&mut self, rhs: &i8)

Performs the <<= operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> ShlAssign<&isize> for Uint<BITS, LIMBS>

source§

fn shl_assign(&mut self, rhs: &isize)

Performs the <<= operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> ShlAssign<&u16> for Uint<BITS, LIMBS>

source§

fn shl_assign(&mut self, rhs: &u16)

Performs the <<= operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> ShlAssign<&u32> for Uint<BITS, LIMBS>

source§

fn shl_assign(&mut self, rhs: &u32)

Performs the <<= operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> ShlAssign<&u64> for Uint<BITS, LIMBS>

source§

fn shl_assign(&mut self, rhs: &u64)

Performs the <<= operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> ShlAssign<&u8> for Uint<BITS, LIMBS>

source§

fn shl_assign(&mut self, rhs: &u8)

Performs the <<= operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> ShlAssign<&usize> for Uint<BITS, LIMBS>

source§

fn shl_assign(&mut self, rhs: &usize)

Performs the <<= operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> ShlAssign<i16> for Uint<BITS, LIMBS>

source§

fn shl_assign(&mut self, rhs: i16)

Performs the <<= operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> ShlAssign<i32> for Uint<BITS, LIMBS>

source§

fn shl_assign(&mut self, rhs: i32)

Performs the <<= operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> ShlAssign<i64> for Uint<BITS, LIMBS>

source§

fn shl_assign(&mut self, rhs: i64)

Performs the <<= operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> ShlAssign<i8> for Uint<BITS, LIMBS>

source§

fn shl_assign(&mut self, rhs: i8)

Performs the <<= operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> ShlAssign<isize> for Uint<BITS, LIMBS>

source§

fn shl_assign(&mut self, rhs: isize)

Performs the <<= operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> ShlAssign<u16> for Uint<BITS, LIMBS>

source§

fn shl_assign(&mut self, rhs: u16)

Performs the <<= operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> ShlAssign<u32> for Uint<BITS, LIMBS>

source§

fn shl_assign(&mut self, rhs: u32)

Performs the <<= operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> ShlAssign<u64> for Uint<BITS, LIMBS>

source§

fn shl_assign(&mut self, rhs: u64)

Performs the <<= operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> ShlAssign<u8> for Uint<BITS, LIMBS>

source§

fn shl_assign(&mut self, rhs: u8)

Performs the <<= operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> ShlAssign<usize> for Uint<BITS, LIMBS>

source§

fn shl_assign(&mut self, rhs: usize)

Performs the <<= operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> ShlAssign for Uint<BITS, LIMBS>

source§

fn shl_assign(&mut self, rhs: Self)

Performs the <<= operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Shr<&Uint<BITS, LIMBS>> for Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

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

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

Performs the >> operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Shr<&i16> for Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

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

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

Performs the >> operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Shr<&i32> for Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

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

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

Performs the >> operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Shr<&i64> for Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

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

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

Performs the >> operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Shr<&i8> for Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

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

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

Performs the >> operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Shr<&isize> for Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

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

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

Performs the >> operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Shr<&u16> for Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

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

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

Performs the >> operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Shr<&u32> for Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

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

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

Performs the >> operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Shr<&u64> for Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

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

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

Performs the >> operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Shr<&u8> for Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

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

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

Performs the >> operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Shr<&usize> for Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

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

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

Performs the >> operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Shr<i16> for Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

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

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

Performs the >> operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Shr<i32> for Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

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

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

Performs the >> operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Shr<i64> for Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

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

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

Performs the >> operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Shr<i8> for Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

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

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

Performs the >> operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Shr<isize> for Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

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

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

Performs the >> operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Shr<u16> for Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

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

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

Performs the >> operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Shr<u32> for Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

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

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

Performs the >> operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Shr<u64> for Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

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

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

Performs the >> operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Shr<u8> for Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

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

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

Performs the >> operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Shr<usize> for Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

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

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

Performs the >> operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Shr for Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

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

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

Performs the >> operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> ShrAssign<&Uint<BITS, LIMBS>> for Uint<BITS, LIMBS>

source§

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

Performs the >>= operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> ShrAssign<&i16> for Uint<BITS, LIMBS>

source§

fn shr_assign(&mut self, rhs: &i16)

Performs the >>= operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> ShrAssign<&i32> for Uint<BITS, LIMBS>

source§

fn shr_assign(&mut self, rhs: &i32)

Performs the >>= operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> ShrAssign<&i64> for Uint<BITS, LIMBS>

source§

fn shr_assign(&mut self, rhs: &i64)

Performs the >>= operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> ShrAssign<&i8> for Uint<BITS, LIMBS>

source§

fn shr_assign(&mut self, rhs: &i8)

Performs the >>= operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> ShrAssign<&isize> for Uint<BITS, LIMBS>

source§

fn shr_assign(&mut self, rhs: &isize)

Performs the >>= operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> ShrAssign<&u16> for Uint<BITS, LIMBS>

source§

fn shr_assign(&mut self, rhs: &u16)

Performs the >>= operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> ShrAssign<&u32> for Uint<BITS, LIMBS>

source§

fn shr_assign(&mut self, rhs: &u32)

Performs the >>= operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> ShrAssign<&u64> for Uint<BITS, LIMBS>

source§

fn shr_assign(&mut self, rhs: &u64)

Performs the >>= operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> ShrAssign<&u8> for Uint<BITS, LIMBS>

source§

fn shr_assign(&mut self, rhs: &u8)

Performs the >>= operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> ShrAssign<&usize> for Uint<BITS, LIMBS>

source§

fn shr_assign(&mut self, rhs: &usize)

Performs the >>= operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> ShrAssign<i16> for Uint<BITS, LIMBS>

source§

fn shr_assign(&mut self, rhs: i16)

Performs the >>= operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> ShrAssign<i32> for Uint<BITS, LIMBS>

source§

fn shr_assign(&mut self, rhs: i32)

Performs the >>= operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> ShrAssign<i64> for Uint<BITS, LIMBS>

source§

fn shr_assign(&mut self, rhs: i64)

Performs the >>= operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> ShrAssign<i8> for Uint<BITS, LIMBS>

source§

fn shr_assign(&mut self, rhs: i8)

Performs the >>= operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> ShrAssign<isize> for Uint<BITS, LIMBS>

source§

fn shr_assign(&mut self, rhs: isize)

Performs the >>= operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> ShrAssign<u16> for Uint<BITS, LIMBS>

source§

fn shr_assign(&mut self, rhs: u16)

Performs the >>= operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> ShrAssign<u32> for Uint<BITS, LIMBS>

source§

fn shr_assign(&mut self, rhs: u32)

Performs the >>= operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> ShrAssign<u64> for Uint<BITS, LIMBS>

source§

fn shr_assign(&mut self, rhs: u64)

Performs the >>= operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> ShrAssign<u8> for Uint<BITS, LIMBS>

source§

fn shr_assign(&mut self, rhs: u8)

Performs the >>= operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> ShrAssign<usize> for Uint<BITS, LIMBS>

source§

fn shr_assign(&mut self, rhs: usize)

Performs the >>= operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> ShrAssign for Uint<BITS, LIMBS>

source§

fn shr_assign(&mut self, rhs: Self)

Performs the >>= operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Structable for Uint<BITS, LIMBS>

Available on crate feature valuable only.
source§

fn definition(&self) -> StructDef<'_>

Returns the struct’s definition. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Sub<&Uint<BITS, LIMBS>> for &Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: &Uint<BITS, LIMBS>) -> Self::Output

Performs the - operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Sub<&Uint<BITS, LIMBS>> for Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: &Uint<BITS, LIMBS>) -> Self::Output

Performs the - operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Sub<Uint<BITS, LIMBS>> for &Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: Uint<BITS, LIMBS>) -> Self::Output

Performs the - operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> Sub for Uint<BITS, LIMBS>

§

type Output = Uint<BITS, LIMBS>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: Uint<BITS, LIMBS>) -> Self::Output

Performs the - operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> SubAssign<&Uint<BITS, LIMBS>> for Uint<BITS, LIMBS>

source§

fn sub_assign(&mut self, rhs: &Uint<BITS, LIMBS>)

Performs the -= operation. Read more
source§

impl<const BITS: usize, const LIMBS: usize> SubAssign for Uint<BITS, LIMBS>

source§

fn sub_assign(&mut self, rhs: Uint<BITS, LIMBS>)

Performs the -= operation. Read more
source§

impl<'a, const BITS: usize, const LIMBS: usize> Sum<&'a Uint<BITS, LIMBS>> for Uint<BITS, LIMBS>

source§

fn sum<I>(iter: I) -> Self
where I: Iterator<Item = &'a Self>,

Method which takes an iterator and generates Self from the elements by “summing up” the items.
source§

impl<const BITS: usize, const LIMBS: usize> Sum for Uint<BITS, LIMBS>

source§

fn sum<I>(iter: I) -> Self
where I: Iterator<Item = Self>,

Method which takes an iterator and generates Self from the elements by “summing up” the items.
source§

impl<const BITS: usize, const LIMBS: usize> ToBytes for Uint<BITS, LIMBS>

Available on crate feature num-traits only.
§

type Bytes = Vec<u8>

source§

fn to_le_bytes(&self) -> Self::Bytes

Return the memory representation of this number as a byte array in little-endian byte order. Read more
source§

fn to_be_bytes(&self) -> Self::Bytes

Return the memory representation of this number as a byte array in big-endian byte order. Read more
source§

fn to_ne_bytes(&self) -> Self::Bytes

Return the memory representation of this number as a byte array in native byte order. Read more
source§

impl<const BITS: usize, const LIMBS: usize> ToPrimitive for Uint<BITS, LIMBS>

Available on crate feature num-traits only.
source§

fn to_i64(&self) -> Option<i64>

Converts the value of self to an i64. If the value cannot be represented by an i64, then None is returned.
source§

fn to_u64(&self) -> Option<u64>

Converts the value of self to a u64. If the value cannot be represented by a u64, then None is returned.
source§

fn to_i128(&self) -> Option<i128>

Converts the value of self to an i128. If the value cannot be represented by an i128 (i64 under the default implementation), then None is returned. Read more
source§

fn to_u128(&self) -> Option<u128>

Converts the value of self to a u128. If the value cannot be represented by a u128 (u64 under the default implementation), then None is returned. Read more
source§

fn to_isize(&self) -> Option<isize>

Converts the value of self to an isize. If the value cannot be represented by an isize, then None is returned.
source§

fn to_i8(&self) -> Option<i8>

Converts the value of self to an i8. If the value cannot be represented by an i8, then None is returned.
source§

fn to_i16(&self) -> Option<i16>

Converts the value of self to an i16. If the value cannot be represented by an i16, then None is returned.
source§

fn to_i32(&self) -> Option<i32>

Converts the value of self to an i32. If the value cannot be represented by an i32, then None is returned.
source§

fn to_usize(&self) -> Option<usize>

Converts the value of self to a usize. If the value cannot be represented by a usize, then None is returned.
source§

fn to_u8(&self) -> Option<u8>

Converts the value of self to a u8. If the value cannot be represented by a u8, then None is returned.
source§

fn to_u16(&self) -> Option<u16>

Converts the value of self to a u16. If the value cannot be represented by a u16, then None is returned.
source§

fn to_u32(&self) -> Option<u32>

Converts the value of self to a u32. If the value cannot be represented by a u32, then None is returned.
source§

fn to_f32(&self) -> Option<f32>

Converts the value of self to an f32. Overflows may map to positive or negative inifinity, otherwise None is returned if the value cannot be represented by an f32.
source§

fn to_f64(&self) -> Option<f64>

Converts the value of self to an f64. Overflows may map to positive or negative inifinity, otherwise None is returned if the value cannot be represented by an f64. Read more
source§

impl<const BITS: usize, const LIMBS: usize> ToPyObject for Uint<BITS, LIMBS>

Available on crate feature pyo3 only.
source§

fn to_object(&self, py: Python<'_>) -> PyObject

Converts self into a Python object.
source§

impl<const BITS: usize, const LIMBS: usize> ToSql for Uint<BITS, LIMBS>

Available on crate feature postgres only.

Convert to Postgres types.

Compatible Postgres data types are:

  • BOOL, SMALLINT, INTEGER, BIGINT which are 1, 16, 32 and 64 bit signed integers respectively.
  • OID which is a 32 bit unsigned integer.
  • FLOAT, DOUBLE PRECISION which are 32 and 64 bit floating point.
  • DECIMAL and NUMERIC, which are variable length.
  • MONEY which is a 64 bit integer with two decimals.
  • BYTEA, BIT, VARBIT interpreted as a big-endian binary number.
  • CHAR, VARCHAR, TEXT as 0x-prefixed big-endian hex strings.
  • JSON, JSONB as a hex string compatible with the Serde serialization.

Note: Uints are never null, use Option<Uint> instead.

§Errors

Returns an error when trying to convert to a value that is too small to fit the number. Note that this depends on the value, not the type, so a Uint<256> can be stored in a SMALLINT column, as long as the values are less than $2^{16}$.

§Implementation details

The Postgres binary formats are used in the wire-protocol and the the COPY BINARY command, but they have very little documentation. You are pointed to the source code, for example this is the implementation of the the NUMERIC type serializer: numeric.c.

source§

fn accepts(ty: &Type) -> bool

Determines if a value of this type can be converted to the specified Postgres Type.
source§

fn to_sql( &self, ty: &Type, out: &mut BytesMut ) -> Result<IsNull, Box<dyn Error + Sync + Send + 'static>>

Converts the value of self into the binary format of the specified Postgres Type, appending it to out. Read more
source§

fn to_sql_checked( &self, ty: &Type, out: &mut BytesMut ) -> Result<IsNull, Box<dyn Error + Sync + Send>>

An adaptor method used internally by Rust-Postgres. Read more
source§

fn encode_format(&self, _ty: &Type) -> Format

Specify the encode format
source§

impl<const BITS: usize, const LIMBS: usize> TryFrom<&BN> for Uint<BITS, LIMBS>

Available on crate feature bn-rs only.
§

type Error = ToUintError<Uint<BITS, LIMBS>>

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

fn try_from(value: &BN) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<const BITS: usize, const LIMBS: usize> TryFrom<&BigInt> for Uint<BITS, LIMBS>

Available on crate feature num-bigint only.
§

type Error = ToUintError<Uint<BITS, LIMBS>>

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

fn try_from(value: &BigInt) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<const BITS: usize, const LIMBS: usize> TryFrom<&BigNumber> for Uint<BITS, LIMBS>

Available on crate feature bn-rs only.
§

type Error = ToUintError<Uint<BITS, LIMBS>>

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

fn try_from(value: &BigNumber) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<const BITS: usize, const LIMBS: usize> TryFrom<&BigUint> for Uint<BITS, LIMBS>

Available on crate feature num-bigint only.
§

type Error = ToUintError<Uint<BITS, LIMBS>>

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

fn try_from(value: &BigUint) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<P: Fp256Parameters> TryFrom<&Uint<256, 4>> for Fp256<P>

Available on crate feature ark-ff only.
§

type Error = ToFieldError

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

fn try_from(value: &Uint<256, 4>) -> Result<Self, ToFieldError>

Performs the conversion.
source§

impl<P: Fp320Parameters> TryFrom<&Uint<320, 5>> for Fp320<P>

Available on crate feature ark-ff only.
§

type Error = ToFieldError

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

fn try_from(value: &Uint<320, 5>) -> Result<Self, ToFieldError>

Performs the conversion.
source§

impl<P: Fp384Parameters> TryFrom<&Uint<384, 6>> for Fp384<P>

Available on crate feature ark-ff only.
§

type Error = ToFieldError

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

fn try_from(value: &Uint<384, 6>) -> Result<Self, ToFieldError>

Performs the conversion.
source§

impl<P: Fp448Parameters> TryFrom<&Uint<448, 7>> for Fp448<P>

Available on crate feature ark-ff only.
§

type Error = ToFieldError

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

fn try_from(value: &Uint<448, 7>) -> Result<Self, ToFieldError>

Performs the conversion.
source§

impl<P: Fp64Parameters> TryFrom<&Uint<64, 1>> for Fp64<P>

Available on crate feature ark-ff only.
§

type Error = ToFieldError

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

fn try_from(value: &Uint<64, 1>) -> Result<Self, ToFieldError>

Performs the conversion.
source§

impl<P: Fp768Parameters> TryFrom<&Uint<768, 12>> for Fp768<P>

Available on crate feature ark-ff only.
§

type Error = ToFieldError

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

fn try_from(value: &Uint<768, 12>) -> Result<Self, ToFieldError>

Performs the conversion.
source§

impl<P: Fp832Parameters> TryFrom<&Uint<832, 13>> for Fp832<P>

Available on crate feature ark-ff only.
§

type Error = ToFieldError

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

fn try_from(value: &Uint<832, 13>) -> Result<Self, ToFieldError>

Performs the conversion.
source§

impl<P: FpConfig<LIMBS>, const BITS: usize, const LIMBS: usize> TryFrom<&Uint<BITS, LIMBS>> for Fp<P, LIMBS>

Available on crate feature ark-ff-04 only.
§

type Error = ToFieldError

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

fn try_from(value: &Uint<BITS, LIMBS>) -> Result<Self, ToFieldError>

Performs the conversion.
source§

impl<const BITS: usize, const LIMBS: usize> TryFrom<&Uint<BITS, LIMBS>> for bool

§

type Error = FromUintError<bool>

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

fn try_from(value: &Uint<BITS, LIMBS>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<const BITS: usize, const LIMBS: usize> TryFrom<&Uint<BITS, LIMBS>> for i128

§

type Error = FromUintError<i128>

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

fn try_from(value: &Uint<BITS, LIMBS>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<const BITS: usize, const LIMBS: usize> TryFrom<&Uint<BITS, LIMBS>> for i16

§

type Error = FromUintError<i16>

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

fn try_from(value: &Uint<BITS, LIMBS>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<const BITS: usize, const LIMBS: usize> TryFrom<&Uint<BITS, LIMBS>> for i32

§

type Error = FromUintError<i32>

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

fn try_from(value: &Uint<BITS, LIMBS>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<const BITS: usize, const LIMBS: usize> TryFrom<&Uint<BITS, LIMBS>> for i64

§

type Error = FromUintError<i64>

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

fn try_from(value: &Uint<BITS, LIMBS>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<const BITS: usize, const LIMBS: usize> TryFrom<&Uint<BITS, LIMBS>> for i8

§

type Error = FromUintError<i8>

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

fn try_from(value: &Uint<BITS, LIMBS>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<const BITS: usize, const LIMBS: usize> TryFrom<&Uint<BITS, LIMBS>> for isize

§

type Error = FromUintError<isize>

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

fn try_from(value: &Uint<BITS, LIMBS>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<const BITS: usize, const LIMBS: usize> TryFrom<&Uint<BITS, LIMBS>> for u128

§

type Error = FromUintError<u128>

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

fn try_from(value: &Uint<BITS, LIMBS>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<const BITS: usize, const LIMBS: usize> TryFrom<&Uint<BITS, LIMBS>> for u16

§

type Error = FromUintError<u16>

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

fn try_from(value: &Uint<BITS, LIMBS>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<const BITS: usize, const LIMBS: usize> TryFrom<&Uint<BITS, LIMBS>> for u32

§

type Error = FromUintError<u32>

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

fn try_from(value: &Uint<BITS, LIMBS>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<const BITS: usize, const LIMBS: usize> TryFrom<&Uint<BITS, LIMBS>> for u64

§

type Error = FromUintError<u64>

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

fn try_from(value: &Uint<BITS, LIMBS>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<const BITS: usize, const LIMBS: usize> TryFrom<&Uint<BITS, LIMBS>> for u8

§

type Error = FromUintError<u8>

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

fn try_from(value: &Uint<BITS, LIMBS>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<const BITS: usize, const LIMBS: usize> TryFrom<&Uint<BITS, LIMBS>> for usize

§

type Error = FromUintError<usize>

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

fn try_from(value: &Uint<BITS, LIMBS>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<const BITS: usize, const LIMBS: usize> TryFrom<BN> for Uint<BITS, LIMBS>

Available on crate feature bn-rs only.
§

type Error = ToUintError<Uint<BITS, LIMBS>>

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

fn try_from(value: BN) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<const BITS: usize, const LIMBS: usize> TryFrom<BigInt> for Uint<BITS, LIMBS>

Available on crate feature num-bigint only.
§

type Error = ToUintError<Uint<BITS, LIMBS>>

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

fn try_from(value: BigInt) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<const BITS: usize, const LIMBS: usize> TryFrom<BigNumber> for Uint<BITS, LIMBS>

Available on crate feature bn-rs only.
§

type Error = ToUintError<Uint<BITS, LIMBS>>

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

fn try_from(value: BigNumber) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<const BITS: usize, const LIMBS: usize> TryFrom<BigUint> for Uint<BITS, LIMBS>

Available on crate feature num-bigint only.
§

type Error = ToUintError<Uint<BITS, LIMBS>>

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

fn try_from(value: BigUint) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<P: Fp256Parameters> TryFrom<Uint<256, 4>> for Fp256<P>

Available on crate feature ark-ff only.
§

type Error = ToFieldError

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

fn try_from(value: Uint<256, 4>) -> Result<Self, ToFieldError>

Performs the conversion.
source§

impl<P: Fp320Parameters> TryFrom<Uint<320, 5>> for Fp320<P>

Available on crate feature ark-ff only.
§

type Error = ToFieldError

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

fn try_from(value: Uint<320, 5>) -> Result<Self, ToFieldError>

Performs the conversion.
source§

impl<P: Fp384Parameters> TryFrom<Uint<384, 6>> for Fp384<P>

Available on crate feature ark-ff only.
§

type Error = ToFieldError

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

fn try_from(value: Uint<384, 6>) -> Result<Self, ToFieldError>

Performs the conversion.
source§

impl<P: Fp448Parameters> TryFrom<Uint<448, 7>> for Fp448<P>

Available on crate feature ark-ff only.
§

type Error = ToFieldError

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

fn try_from(value: Uint<448, 7>) -> Result<Self, ToFieldError>

Performs the conversion.
source§

impl<P: Fp64Parameters> TryFrom<Uint<64, 1>> for Fp64<P>

Available on crate feature ark-ff only.
§

type Error = ToFieldError

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

fn try_from(value: Uint<64, 1>) -> Result<Self, ToFieldError>

Performs the conversion.
source§

impl<P: Fp768Parameters> TryFrom<Uint<768, 12>> for Fp768<P>

Available on crate feature ark-ff only.
§

type Error = ToFieldError

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

fn try_from(value: Uint<768, 12>) -> Result<Self, ToFieldError>

Performs the conversion.
source§

impl<P: Fp832Parameters> TryFrom<Uint<832, 13>> for Fp832<P>

Available on crate feature ark-ff only.
§

type Error = ToFieldError

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

fn try_from(value: Uint<832, 13>) -> Result<Self, ToFieldError>

Performs the conversion.
source§

impl<P: FpConfig<LIMBS>, const BITS: usize, const LIMBS: usize> TryFrom<Uint<BITS, LIMBS>> for Fp<P, LIMBS>

Available on crate feature ark-ff-04 only.
§

type Error = ToFieldError

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

fn try_from(value: Uint<BITS, LIMBS>) -> Result<Self, ToFieldError>

Performs the conversion.
source§

impl<const BITS: usize, const LIMBS: usize> TryFrom<Uint<BITS, LIMBS>> for bool

§

type Error = FromUintError<bool>

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

fn try_from(value: Uint<BITS, LIMBS>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<const BITS: usize, const LIMBS: usize> TryFrom<Uint<BITS, LIMBS>> for i128

§

type Error = FromUintError<i128>

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

fn try_from(value: Uint<BITS, LIMBS>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<const BITS: usize, const LIMBS: usize> TryFrom<Uint<BITS, LIMBS>> for i16

§

type Error = FromUintError<i16>

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

fn try_from(value: Uint<BITS, LIMBS>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<const BITS: usize, const LIMBS: usize> TryFrom<Uint<BITS, LIMBS>> for i32

§

type Error = FromUintError<i32>

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

fn try_from(value: Uint<BITS, LIMBS>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<const BITS: usize, const LIMBS: usize> TryFrom<Uint<BITS, LIMBS>> for i64

§

type Error = FromUintError<i64>

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

fn try_from(value: Uint<BITS, LIMBS>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<const BITS: usize, const LIMBS: usize> TryFrom<Uint<BITS, LIMBS>> for i8

§

type Error = FromUintError<i8>

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

fn try_from(value: Uint<BITS, LIMBS>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<const BITS: usize, const LIMBS: usize> TryFrom<Uint<BITS, LIMBS>> for isize

§

type Error = FromUintError<isize>

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

fn try_from(value: Uint<BITS, LIMBS>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<const BITS: usize, const LIMBS: usize> TryFrom<Uint<BITS, LIMBS>> for u128

§

type Error = FromUintError<u128>

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

fn try_from(value: Uint<BITS, LIMBS>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<const BITS: usize, const LIMBS: usize> TryFrom<Uint<BITS, LIMBS>> for u16

§

type Error = FromUintError<u16>

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

fn try_from(value: Uint<BITS, LIMBS>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<const BITS: usize, const LIMBS: usize> TryFrom<Uint<BITS, LIMBS>> for u32

§

type Error = FromUintError<u32>

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

fn try_from(value: Uint<BITS, LIMBS>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<const BITS: usize, const LIMBS: usize> TryFrom<Uint<BITS, LIMBS>> for u64

§

type Error = FromUintError<u64>

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

fn try_from(value: Uint<BITS, LIMBS>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<const BITS: usize, const LIMBS: usize> TryFrom<Uint<BITS, LIMBS>> for u8

§

type Error = FromUintError<u8>

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

fn try_from(value: Uint<BITS, LIMBS>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<const BITS: usize, const LIMBS: usize> TryFrom<Uint<BITS, LIMBS>> for usize

§

type Error = FromUintError<usize>

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

fn try_from(value: Uint<BITS, LIMBS>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<const BITS: usize, const LIMBS: usize> TryFrom<bool> for Uint<BITS, LIMBS>

§

type Error = ToUintError<Uint<BITS, LIMBS>>

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

fn try_from(value: bool) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<const BITS: usize, const LIMBS: usize> TryFrom<f32> for Uint<BITS, LIMBS>

Available on crate feature std only.
§

type Error = ToUintError<Uint<BITS, LIMBS>>

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

fn try_from(value: f32) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<const BITS: usize, const LIMBS: usize> TryFrom<f64> for Uint<BITS, LIMBS>

Available on crate feature std only.
§

type Error = ToUintError<Uint<BITS, LIMBS>>

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

fn try_from(value: f64) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<const BITS: usize, const LIMBS: usize> TryFrom<i128> for Uint<BITS, LIMBS>

§

type Error = ToUintError<Uint<BITS, LIMBS>>

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

fn try_from(value: i128) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<const BITS: usize, const LIMBS: usize> TryFrom<i16> for Uint<BITS, LIMBS>

§

type Error = ToUintError<Uint<BITS, LIMBS>>

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

fn try_from(value: i16) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<const BITS: usize, const LIMBS: usize> TryFrom<i32> for Uint<BITS, LIMBS>

§

type Error = ToUintError<Uint<BITS, LIMBS>>

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

fn try_from(value: i32) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<const BITS: usize, const LIMBS: usize> TryFrom<i64> for Uint<BITS, LIMBS>

§

type Error = ToUintError<Uint<BITS, LIMBS>>

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

fn try_from(value: i64) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<const BITS: usize, const LIMBS: usize> TryFrom<i8> for Uint<BITS, LIMBS>

§

type Error = ToUintError<Uint<BITS, LIMBS>>

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

fn try_from(value: i8) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<const BITS: usize, const LIMBS: usize> TryFrom<isize> for Uint<BITS, LIMBS>

§

type Error = ToUintError<Uint<BITS, LIMBS>>

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

fn try_from(value: isize) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<const BITS: usize, const LIMBS: usize> TryFrom<u128> for Uint<BITS, LIMBS>

§

type Error = ToUintError<Uint<BITS, LIMBS>>

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

fn try_from(value: u128) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<const BITS: usize, const LIMBS: usize> TryFrom<u16> for Uint<BITS, LIMBS>

§

type Error = ToUintError<Uint<BITS, LIMBS>>

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

fn try_from(value: u16) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<const BITS: usize, const LIMBS: usize> TryFrom<u32> for Uint<BITS, LIMBS>

§

type Error = ToUintError<Uint<BITS, LIMBS>>

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

fn try_from(value: u32) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<const BITS: usize, const LIMBS: usize> TryFrom<u64> for Uint<BITS, LIMBS>

§

type Error = ToUintError<Uint<BITS, LIMBS>>

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

fn try_from(value: u64) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<const BITS: usize, const LIMBS: usize> TryFrom<u8> for Uint<BITS, LIMBS>

§

type Error = ToUintError<Uint<BITS, LIMBS>>

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

fn try_from(value: u8) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<const BITS: usize, const LIMBS: usize> TryFrom<usize> for Uint<BITS, LIMBS>

§

type Error = ToUintError<Uint<BITS, LIMBS>>

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

fn try_from(value: usize) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<const BITS: usize, const LIMBS: usize, DB: Database> Type<DB> for Uint<BITS, LIMBS>
where Vec<u8>: Type<DB>,

Available on crate feature sqlx only.
source§

fn type_info() -> DB::TypeInfo

Returns the canonical SQL type for this Rust type. Read more
source§

fn compatible(ty: &DB::TypeInfo) -> bool

Determines if this Rust type is compatible with the given SQL type. Read more
source§

impl<const BITS: usize, const LIMBS: usize> UpperHex for Uint<BITS, LIMBS>

Available on crate feature alloc only.
source§

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

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

impl<const BITS: usize, const LIMBS: usize> Valuable for Uint<BITS, LIMBS>

Available on crate feature valuable only.
source§

fn as_value(&self) -> Value<'_>

Converts self into a Value instance. Read more
source§

fn visit(&self, visitor: &mut dyn Visit)

Calls the relevant method on Visit to extract data from self. Read more
source§

fn visit_slice(slice: &[Self], visit: &mut dyn Visit)
where Self: Sized,

source§

impl<const BITS: usize, const LIMBS: usize> WrappingAdd for Uint<BITS, LIMBS>

Available on crate feature num-traits only.
source§

fn wrapping_add(&self, v: &Self) -> Self

Wrapping (modular) addition. Computes self + other, wrapping around at the boundary of the type.
source§

impl<const BITS: usize, const LIMBS: usize> WrappingMul for Uint<BITS, LIMBS>

Available on crate feature num-traits only.
source§

fn wrapping_mul(&self, v: &Self) -> Self

Wrapping (modular) multiplication. Computes self * other, wrapping around at the boundary of the type.
source§

impl<const BITS: usize, const LIMBS: usize> WrappingNeg for Uint<BITS, LIMBS>

Available on crate feature num-traits only.
source§

fn wrapping_neg(&self) -> Self

Wrapping (modular) negation. Computes -self, wrapping around at the boundary of the type. Read more
source§

impl<const BITS: usize, const LIMBS: usize> WrappingShl for Uint<BITS, LIMBS>

Available on crate feature num-traits only.
source§

fn wrapping_shl(&self, rhs: u32) -> Self

Panic-free bitwise shift-left; yields self << mask(rhs), where mask removes any high order bits of rhs that would cause the shift to exceed the bitwidth of the type. Read more
source§

impl<const BITS: usize, const LIMBS: usize> WrappingShr for Uint<BITS, LIMBS>

Available on crate feature num-traits only.
source§

fn wrapping_shr(&self, rhs: u32) -> Self

Panic-free bitwise shift-right; yields self >> mask(rhs), where mask removes any high order bits of rhs that would cause the shift to exceed the bitwidth of the type. Read more
source§

impl<const BITS: usize, const LIMBS: usize> WrappingSub for Uint<BITS, LIMBS>

Available on crate feature num-traits only.
source§

fn wrapping_sub(&self, v: &Self) -> Self

Wrapping (modular) subtraction. Computes self - other, wrapping around at the boundary of the type.
source§

impl<const BITS: usize, const LIMBS: usize> Zero for Uint<BITS, LIMBS>

Available on crate feature num-traits only.
source§

fn zero() -> Self

Returns the additive identity element of Self, 0. Read more
source§

fn is_zero(&self) -> bool

Returns true if self is equal to the additive identity.
source§

fn set_zero(&mut self)

Sets self to the additive identity element of Self, 0.
source§

impl<const BITS: usize, const LIMBS: usize> Zeroable for Uint<{ BITS }, { LIMBS }>

Available on crate feature bytemuck only.
source§

fn zeroed() -> Self

source§

impl<const BITS: usize, const LIMBS: usize> Zeroize for Uint<BITS, LIMBS>

Available on crate feature zeroize only.
source§

fn zeroize(&mut self)

Zero out this object from memory using Rust intrinsics which ensure the zeroization operation is not “optimized away” by the compiler.
source§

impl<const BITS: usize, const LIMBS: usize> Copy for Uint<BITS, LIMBS>

source§

impl<const BITS: usize, const LIMBS: usize> Eq for Uint<BITS, LIMBS>

source§

impl<const BITS: usize, const LIMBS: usize> MaxEncodedLen<{ Self::BYTES + length_of_length(Self::BYTES) }> for Uint<BITS, LIMBS>

Available on crate feature alloy-rlp only.
source§

impl Pod for Uint<{ 1024 }, 16>

Available on crate feature bytemuck only.
source§

impl Pod for Uint<{ 128 }, 2>

Available on crate feature bytemuck only.
source§

impl Pod for Uint<{ 192 }, 3>

Available on crate feature bytemuck only.
source§

impl Pod for Uint<{ 256 }, 4>

Available on crate feature bytemuck only.
source§

impl Pod for Uint<{ 320 }, 5>

Available on crate feature bytemuck only.
source§

impl Pod for Uint<{ 384 }, 6>

Available on crate feature bytemuck only.
source§

impl Pod for Uint<{ 448 }, 7>

Available on crate feature bytemuck only.
source§

impl Pod for Uint<{ 512 }, 8>

Available on crate feature bytemuck only.
source§

impl Pod for Uint<{ 576 }, 9>

Available on crate feature bytemuck only.
source§

impl Pod for Uint<{ 64 }, 1>

Available on crate feature bytemuck only.
source§

impl Pod for Uint<{ 640 }, 10>

Available on crate feature bytemuck only.
source§

impl Pod for Uint<{ 704 }, 11>

Available on crate feature bytemuck only.
source§

impl Pod for Uint<{ 768 }, 12>

Available on crate feature bytemuck only.
source§

impl Pod for Uint<{ 832 }, 13>

Available on crate feature bytemuck only.
source§

impl Pod for Uint<{ 896 }, 14>

Available on crate feature bytemuck only.
source§

impl Pod for Uint<{ 960 }, 15>

Available on crate feature bytemuck only.
source§

impl<const BITS: usize, const LIMBS: usize> StructuralPartialEq for Uint<BITS, LIMBS>

source§

impl<const BITS: usize, const LIMBS: usize, T> UintTryFrom<T> for Uint<BITS, LIMBS>
where Self: TryFrom<T, Error = ToUintError<Self>>,

Blanket implementation for any type that implements TryFrom<Uint>.

source§

impl<const BITS: usize, const LIMBS: usize, const BITS_SRC: usize, const LIMBS_SRC: usize> UintTryFrom<Uint<BITS_SRC, LIMBS_SRC>> for Uint<BITS, LIMBS>

source§

impl<const BITS: usize, const LIMBS: usize, T> UintTryTo<T> for Uint<BITS, LIMBS>
where T: for<'a> TryFrom<&'a Self, Error = FromUintError<T>>,

source§

impl<const BITS: usize, const LIMBS: usize, const BITS_DST: usize, const LIMBS_DST: usize> UintTryTo<Uint<BITS_DST, LIMBS_DST>> for Uint<BITS, LIMBS>

source§

impl<const BITS: usize, const LIMBS: usize> Unsigned for Uint<BITS, LIMBS>

Available on crate feature num-traits only.

Auto Trait Implementations§

§

impl<const BITS: usize, const LIMBS: usize> Freeze for Uint<BITS, LIMBS>

§

impl<const BITS: usize, const LIMBS: usize> RefUnwindSafe for Uint<BITS, LIMBS>

§

impl<const BITS: usize, const LIMBS: usize> Send for Uint<BITS, LIMBS>

§

impl<const BITS: usize, const LIMBS: usize> Sync for Uint<BITS, LIMBS>

§

impl<const BITS: usize, const LIMBS: usize> Unpin for Uint<BITS, LIMBS>

§

impl<const BITS: usize, const LIMBS: usize> UnwindSafe for Uint<BITS, LIMBS>

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> BorrowToSql for T
where T: ToSql,

source§

fn borrow_to_sql(&self) -> &dyn ToSql

Returns a reference to self as a ToSql trait object.
source§

impl<T> CheckedBitPattern for T
where T: AnyBitPattern,

§

type Bits = T

Self must have the same layout as the specified Bits except for the possible invalid bit patterns being checked during is_valid_bit_pattern.
source§

fn is_valid_bit_pattern(_bits: &T) -> bool

If this function returns true, then it must be valid to reinterpret bits as &Self.
source§

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

source§

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

Compare self to key and return their ordering.
source§

impl<T> DecodeAll for T
where T: Decode,

source§

fn decode_all(input: &mut &[u8]) -> Result<T, Error>

Decode Self and consume all of the given input data. Read more
source§

impl<T> DecodeLimit for T
where T: Decode,

source§

fn decode_all_with_depth_limit( limit: u32, input: &mut &[u8] ) -> Result<T, Error>

Decode Self and consume all of the given input data. Read more
source§

fn decode_with_depth_limit<I>(limit: u32, input: &mut I) -> Result<T, Error>
where I: Input,

Decode Self with the given maximum recursion depth and advance input by the number of bytes consumed. Read more
source§

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

source§

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

Checks if this value is equivalent to the given key. Read more
source§

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

source§

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

Compare self to key and return 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> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<T> KeyedVec for T
where T: Codec,

source§

fn to_keyed_vec(&self, prepend_key: &[u8]) -> Vec<u8>

Return an encoding of Self prepended by given slice.
source§

impl<T> LowerBounded for T
where T: Bounded,

source§

fn min_value() -> T

Returns the smallest finite number this type can represent
source§

impl<T> OkWrap<T> for T
where T: IntoPy<Py<PyAny>>,

§

type Error = PyErr

source§

fn wrap(self, py: Python<'_>) -> Result<Py<PyAny>, PyErr>

source§

impl<T> PyErrArguments for T
where T: IntoPy<Py<PyAny>> + Send + Sync,

source§

fn arguments(self, py: Python<'_>) -> Py<PyAny>

Arguments for exception
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

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

§

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§

default 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>,

§

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>,

§

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> UniformRand for T

source§

fn rand<R>(rng: &mut R) -> T
where R: Rng + ?Sized,

source§

impl<T> UniformRand for T

source§

fn rand<R>(rng: &mut R) -> T
where R: Rng + ?Sized,

source§

impl<T> UpperBounded for T
where T: Bounded,

source§

fn max_value() -> T

Returns the largest finite number this type can represent
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> AnyBitPattern for T
where T: Pod,

source§

impl<S> Codec for S
where S: Decode + Encode,

source§

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

source§

impl<T> EncodeLike<&&T> for T
where T: Encode,

source§

impl<T> EncodeLike<&T> for T
where T: Encode,

source§

impl<T> EncodeLike<&mut T> for T
where T: Encode,

source§

impl<T> EncodeLike<Arc<T>> for T
where T: Encode,

source§

impl<T> EncodeLike<Box<T>> for T
where T: Encode,

source§

impl<'a, T> EncodeLike<Cow<'a, T>> for T
where T: ToOwned + Encode,

source§

impl<T> EncodeLike<Rc<T>> for T
where T: Encode,

source§

impl<T> FromSqlOwned for T
where T: for<'a> FromSql<'a>,

source§

impl<T> NoUninit for T
where T: Pod,

source§

impl<T> NumAssign for T
where T: Num + NumAssignOps,

source§

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

source§

impl<T> NumAssignRef for T
where T: NumAssign + for<'r> NumAssignOps<&'r T>,

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> NumRef for T
where T: Num + for<'r> NumOps<&'r T>,

source§

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

source§

impl<T> Ungil for T
where T: Send,