ruint

Struct 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>

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]

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]

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]>

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]>

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>

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>

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>

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>

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>

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>

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>

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

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

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

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

Double precision logarithm.

Source

pub fn approx_log2(self) -> f64

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

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

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>

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

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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

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>

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> Default for Uint<BITS, LIMBS>

Source§

fn default() -> Self

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

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

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> Div<&Uint<BITS, LIMBS>> for &Uint<BITS, LIMBS>

Source§

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>

Source§

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>

Source§

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>

Source§

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>

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<const BITS: usize, const LIMBS: usize> From<&Uint<BITS, LIMBS>> for f32

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

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<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<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 f32

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

Source§

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

Converts to this type from the input type.
Source§

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

Source§

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> 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> LowerHex for Uint<BITS, LIMBS>

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> MaxEncodedLenAssoc for Uint<BITS, LIMBS>

Source§

const LEN: usize = _

The maximum length.
Source§

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

Source§

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>

Source§

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>

Source§

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>

Source§

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

Source§

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>

Source§

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>

Source§

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>

Source§

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> Octal for Uint<BITS, LIMBS>

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> 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,

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

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

Source§

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

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

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

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

impl<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

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

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

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

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

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

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

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

impl<'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>,

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>,

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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> Shl<&Uint<BITS, LIMBS>> for Uint<BITS, LIMBS>

Source§

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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> Sub<&Uint<BITS, LIMBS>> for &Uint<BITS, LIMBS>

Source§

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>

Source§

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>

Source§

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>

Source§

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>,

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>,

Takes an iterator and generates Self from the elements by “summing up” the items.
Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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<Uint<BITS, LIMBS>> for bool

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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>

Source§

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> UpperHex for Uint<BITS, LIMBS>

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> Copy for Uint<BITS, LIMBS>

Source§

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

Source§

impl MaxEncodedLen<{ BYTES + length_of_length(BYTES) }> for Uint<BITS, LIMBS>

Source§

impl MaxEncodedLen<{ BYTES + length_of_length(BYTES) }> for Uint<BITS, LIMBS>

Source§

impl MaxEncodedLen<{ BYTES + length_of_length(BYTES) }> for Uint<BITS, LIMBS>

Source§

impl MaxEncodedLen<{ BYTES + length_of_length(BYTES) }> for Uint<BITS, LIMBS>

Source§

impl MaxEncodedLen<{ BYTES + length_of_length(BYTES) }> for Uint<BITS, LIMBS>

Source§

impl MaxEncodedLen<{ BYTES + length_of_length(BYTES) }> for Uint<BITS, LIMBS>

Source§

impl MaxEncodedLen<{ BYTES + length_of_length(BYTES) }> for Uint<BITS, LIMBS>

Source§

impl MaxEncodedLen<{ BYTES + length_of_length(BYTES) }> for Uint<BITS, LIMBS>

Source§

impl MaxEncodedLen<{ BYTES + length_of_length(BYTES) }> for Uint<BITS, LIMBS>

Source§

impl MaxEncodedLen<{ BYTES + length_of_length(BYTES) }> for Uint<BITS, LIMBS>

Source§

impl MaxEncodedLen<{ BYTES + length_of_length(BYTES) }> for Uint<BITS, LIMBS>

Source§

impl MaxEncodedLen<{ BYTES + length_of_length(BYTES) }> for Uint<BITS, LIMBS>

Source§

impl MaxEncodedLen<{ BYTES + length_of_length(BYTES) }> for Uint<BITS, LIMBS>

Source§

impl MaxEncodedLen<{ BYTES + length_of_length(BYTES) }> for Uint<BITS, LIMBS>

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>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

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

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

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

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

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

Source§

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>,

Source§

type Error = Infallible

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

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

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.