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_euclidandu64::rem_euclidare left out because they are meaningless or redundant for unsigned integers. Std has them for compatibility with their signed integers. - Many functions that are
constin std are not inUint. Uint::to_le_bytesandUint::to_be_bytesrequire the output size to be provided as a const-generic argument. They will runtime panic if the provided size is incorrect.Uint::widening_multakes as argument anUintof 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>
impl<const BITS: usize, const LIMBS: usize> Uint<BITS, LIMBS>
Sourcepub fn abs_diff(self, other: Self) -> Self
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$.
Sourcepub const fn checked_add(self, rhs: Self) -> Option<Self>
pub const fn checked_add(self, rhs: Self) -> Option<Self>
Computes self + rhs, returning None if overflow occurred.
Sourcepub const fn checked_neg(self) -> Option<Self>
pub const fn checked_neg(self) -> Option<Self>
Computes -self, returning None unless self == 0.
Sourcepub const fn checked_sub(self, rhs: Self) -> Option<Self>
pub const fn checked_sub(self, rhs: Self) -> Option<Self>
Computes self - rhs, returning None if overflow occurred.
Sourcepub const fn overflowing_add(self, rhs: Self) -> (Self, bool)
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.
Sourcepub const fn overflowing_neg(self) -> (Self, bool)
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.
Sourcepub const fn overflowing_sub(self, rhs: Self) -> (Self, bool)
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.
Sourcepub const fn saturating_add(self, rhs: Self) -> Self
pub const fn saturating_add(self, rhs: Self) -> Self
Computes self + rhs, saturating at the numeric bounds instead of
overflowing.
Sourcepub const fn saturating_sub(self, rhs: Self) -> Self
pub const fn saturating_sub(self, rhs: Self) -> Self
Computes self - rhs, saturating at the numeric bounds instead of
overflowing
Sourcepub const fn wrapping_add(self, rhs: Self) -> Self
pub const fn wrapping_add(self, rhs: Self) -> Self
Computes self + rhs, wrapping around at the boundary of the type.
Sourcepub const fn wrapping_neg(self) -> Self
pub const fn wrapping_neg(self) -> Self
Computes -self, wrapping around at the boundary of the type.
Sourcepub const fn wrapping_sub(self, rhs: Self) -> Self
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>
impl<const BITS: usize, const LIMBS: usize> Uint<BITS, LIMBS>
Sourcepub fn to_base_le(&self, base: u64) -> impl Iterator<Item = u64>
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.
Sourcepub fn to_base_be(&self, base: u64) -> impl Iterator<Item = u64>
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.
Use to_base_be_2 to extract the maximum number
of digits at once more efficiently.
§Panics
Panics if the base is less than 2.
§Examples
let n = ruint::aliases::U64::from(1234);
assert_eq!(n.to_base_be(10).collect::<Vec<_>>(), [1, 2, 3, 4]);
assert_eq!(n.to_base_be(1000000).collect::<Vec<_>>(), [1234]);
// `to_base_be_2` always returns digits maximally packed into `u64`s.
assert_eq!(n.to_base_be_2(10).collect::<Vec<_>>(), [1234]);
assert_eq!(n.to_base_be_2(1000000).collect::<Vec<_>>(), [1234]);Sourcepub fn to_base_be_2(&self, base: u64) -> impl Iterator<Item = u64>
pub fn to_base_be_2(&self, base: u64) -> impl Iterator<Item = u64>
Returns an iterator over the base base digits of the number in
big-endian order.
Always returns digits maximally packed into u64s.
Unlike to_base_be, this method:
- never heap-allocates memory, so it’s always faster
- always returns digits maximally packed into
u64s, so passing the constant base like2,8, instead of the highest power that fits in u64 is not needed
§Panics
Panics if the base is less than 2.
§Examples
See to_base_be.
Sourcepub fn from_base_le<I>(base: u64, digits: I) -> Result<Self, BaseConvertError>where
I: IntoIterator<Item = u64>,
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
BaseConvertError::InvalidBaseif the base is less than 2.BaseConvertError::InvalidDigitif a digit is out of range.BaseConvertError::Overflowif the number is too large to fit.
Sourcepub fn from_base_be<I: IntoIterator<Item = u64>>(
base: u64,
digits: I,
) -> Result<Self, BaseConvertError>
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
BaseConvertError::InvalidBaseif the base is less than 2.BaseConvertError::InvalidDigitif a digit is out of range.BaseConvertError::Overflowif the number is too large to fit.
Source§impl<const BITS: usize, const LIMBS: usize> Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> Uint<BITS, LIMBS>
Sourcepub const fn bit(&self, index: usize) -> bool
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.
Sourcepub const fn byte(&self, index: usize) -> u8
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 is greater than or equal to 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);Sourcepub const fn checked_byte(&self, index: usize) -> Option<u8>
pub const fn checked_byte(&self, index: usize) -> Option<u8>
Returns a specific byte, or None if index is out of range. The byte
at index 0 is the least significant byte (little endian).
§Examples
let x = uint!(0x1234567890_U64);
assert_eq!(x.checked_byte(0), Some(0x90));
assert_eq!(x.checked_byte(7), Some(0x00));
// Out of range
assert_eq!(x.checked_byte(8), None);Sourcepub fn reverse_bits(self) -> Self
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.
Sourcepub const fn leading_zeros(&self) -> usize
pub const fn leading_zeros(&self) -> usize
Returns the number of leading zeros in the binary representation of
self.
Sourcepub const fn leading_ones(&self) -> usize
pub const fn leading_ones(&self) -> usize
Returns the number of leading ones in the binary representation of
self.
Sourcepub fn trailing_zeros(&self) -> usize
pub fn trailing_zeros(&self) -> usize
Returns the number of trailing zeros in the binary representation of
self.
Sourcepub fn trailing_ones(&self) -> usize
pub fn trailing_ones(&self) -> usize
Returns the number of trailing ones in the binary representation of
self.
Sourcepub const fn count_ones(&self) -> usize
pub const fn count_ones(&self) -> usize
Returns the number of ones in the binary representation of self.
Sourcepub const fn count_zeros(&self) -> usize
pub const fn count_zeros(&self) -> usize
Returns the number of zeros in the binary representation of self.
Sourcepub const fn bit_len(&self) -> usize
pub const fn bit_len(&self) -> usize
Returns the dynamic length of this number in bits, ignoring leading zeros.
For the maximum length of the type, use Uint::BITS.
Sourcepub const fn byte_len(&self) -> usize
pub const fn byte_len(&self) -> usize
Returns the dynamic length of this number in bytes, ignoring leading zeros.
For the maximum length of the type, use Uint::BYTES.
Sourcepub fn most_significant_bits(&self) -> (u64, usize)
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.
Sourcepub const fn checked_shl(self, rhs: usize) -> Option<Self>
pub const 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).
Sourcepub const fn saturating_shl(self, rhs: usize) -> Self
pub const fn saturating_shl(self, rhs: usize) -> Self
Sourcepub const fn overflowing_shl(self, rhs: usize) -> (Self, bool)
pub const 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).
Sourcepub const fn wrapping_shl(self, rhs: usize) -> Self
pub const 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).
Sourcepub const fn checked_shr(self, rhs: usize) -> Option<Self>
pub const 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).
Sourcepub const fn overflowing_shr(self, rhs: usize) -> (Self, bool)
pub const 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).
Sourcepub const fn wrapping_shr(self, rhs: usize) -> Self
pub const 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).
Sourcepub const fn arithmetic_shr(self, rhs: usize) -> Self
pub const fn arithmetic_shr(self, rhs: usize) -> Self
Arithmetic shift right by rhs bits.
Sourcepub const fn rotate_left(self, rhs: usize) -> Self
pub const 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.
Sourcepub const fn rotate_right(self, rhs: usize) -> Self
pub const 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>
impl<const BITS: usize, const LIMBS: usize> Uint<BITS, LIMBS>
Sourcepub const BYTES: usize
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.
Sourcepub const fn as_le_slice(&self) -> &[u8] ⓘ
Available on little-endian only.
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.
Sourcepub const unsafe fn as_le_slice_mut(&mut self) -> &mut [u8] ⓘ
Available on little-endian only.
pub const unsafe fn as_le_slice_mut(&mut self) -> &mut [u8] ⓘ
Sourcepub fn as_le_bytes(&self) -> Cow<'_, [u8]>
Available on crate feature alloc only.
pub fn as_le_bytes(&self) -> Cow<'_, [u8]>
alloc only.Access the underlying store as a little-endian bytes.
Uses an optimized implementation on little-endian targets.
Sourcepub fn as_le_bytes_trimmed(&self) -> Cow<'_, [u8]>
Available on crate feature alloc only.
pub fn as_le_bytes_trimmed(&self) -> Cow<'_, [u8]>
alloc only.Access the underlying store as a little-endian bytes with trailing zeros removed.
Uses an optimized implementation on little-endian targets.
Sourcepub const fn to_le_bytes<const BYTES: usize>(&self) -> [u8; BYTES]
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.
Sourcepub fn to_le_bytes_vec(&self) -> Vec<u8> ⓘ
Available on crate feature alloc only.
pub fn to_le_bytes_vec(&self) -> Vec<u8> ⓘ
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.
Sourcepub fn to_le_bytes_trimmed_vec(&self) -> Vec<u8> ⓘ
Available on crate feature alloc only.
pub fn to_le_bytes_trimmed_vec(&self) -> Vec<u8> ⓘ
alloc only.Converts the Uint to a little-endian byte vector with trailing zeros
bytes removed.
Sourcepub const fn to_be_bytes<const BYTES: usize>(&self) -> [u8; BYTES]
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.
Sourcepub fn to_be_bytes_vec(&self) -> Vec<u8> ⓘ
Available on crate feature alloc only.
pub fn to_be_bytes_vec(&self) -> Vec<u8> ⓘ
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.
Sourcepub fn to_be_bytes_trimmed_vec(&self) -> Vec<u8> ⓘ
Available on crate feature alloc only.
pub fn to_be_bytes_trimmed_vec(&self) -> Vec<u8> ⓘ
alloc only.Converts the Uint to a big-endian byte vector with leading zeros
bytes removed.
Sourcepub const fn from_be_bytes<const BYTES: usize>(bytes: [u8; BYTES]) -> Self
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.
Sourcepub const fn from_be_slice(bytes: &[u8]) -> Self
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, and must be at most
Self::BYTES long.
§Panics
Panics if the value is larger than fits the Uint.
Sourcepub const fn try_from_be_slice(bytes: &[u8]) -> Option<Self>
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, and must be at most
Self::BYTES long.
Sourcepub const fn from_le_bytes<const BYTES: usize>(bytes: [u8; BYTES]) -> Self
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.
Sourcepub const fn from_le_slice(bytes: &[u8]) -> Self
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, and must be at most
Self::BYTES long.
§Panics
Panics if the value is larger than fits the Uint.
Sourcepub const fn try_from_le_slice(bytes: &[u8]) -> Option<Self>
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, and must be at most
Self::BYTES long.
Sourcepub fn copy_le_bytes_to(&self, buf: &mut [u8]) -> usize
pub fn copy_le_bytes_to(&self, buf: &mut [u8]) -> usize
Writes the little-endian representation of the Uint to the given
buffer. The buffer must be large enough to hold Self::BYTES bytes.
§Panics
Panics if the buffer is not large enough to hold Self::BYTES bytes.
§Returns
The number of bytes written to the buffer (always equal to
Self::BYTES, but often useful to make explicit for encoders).
Sourcepub fn checked_copy_le_bytes_to(&self, buf: &mut [u8]) -> Option<usize>
pub fn checked_copy_le_bytes_to(&self, buf: &mut [u8]) -> Option<usize>
Writes the little-endian representation of the Uint to the given
buffer. The buffer must be large enough to hold Self::BYTES bytes.
§Returns
None, if the buffer is not large enough to hold Self::BYTES
bytes, and does not modify the buffer.
Some with the number of bytes written to the buffer (always
equal to Self::BYTES, but often useful to make explicit for
encoders).
Sourcepub fn copy_be_bytes_to(&self, buf: &mut [u8]) -> usize
pub fn copy_be_bytes_to(&self, buf: &mut [u8]) -> usize
Writes the big-endian representation of the Uint to the given
buffer. The buffer must be large enough to hold Self::BYTES bytes.
§Panics
Panics if the buffer is not large enough to hold Self::BYTES bytes.
§Returns
The number of bytes written to the buffer (always equal to
Self::BYTES, but often useful to make explicit for encoders).
Sourcepub fn checked_copy_be_bytes_to(&self, buf: &mut [u8]) -> Option<usize>
pub fn checked_copy_be_bytes_to(&self, buf: &mut [u8]) -> Option<usize>
Writes the big-endian representation of the Uint to the given
buffer. The buffer must be large enough to hold Self::BYTES bytes.
§Returns
None, if the buffer is not large enough to hold Self::BYTES
bytes, and does not modify the buffer.
Some with the number of bytes written to the buffer (always
equal to Self::BYTES, but often useful to make explicit for
encoders).
Source§impl<const BITS: usize, const LIMBS: usize> Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> Uint<BITS, LIMBS>
Sourcepub const fn const_is_zero(&self) -> bool
pub const fn const_is_zero(&self) -> bool
Returns true if the value is zero.
Note that this currently might perform worse than
is_zero.
Source§impl<const BITS: usize, const LIMBS: usize> Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> Uint<BITS, LIMBS>
Sourcepub fn checked_div(self, rhs: Self) -> Option<Self>
pub fn checked_div(self, rhs: Self) -> Option<Self>
Computes self / rhs, returning None if rhs == 0.
Sourcepub fn checked_rem(self, rhs: Self) -> Option<Self>
pub fn checked_rem(self, rhs: Self) -> Option<Self>
Computes self % rhs, returning None if rhs == 0.
Sourcepub fn wrapping_div(self, rhs: Self) -> Self
pub fn wrapping_div(self, rhs: Self) -> Self
Sourcepub fn wrapping_rem(self, rhs: Self) -> Self
pub fn wrapping_rem(self, rhs: Self) -> Self
Source§impl<const BITS: usize, const LIMBS: usize> Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> Uint<BITS, LIMBS>
Sourcepub fn from<T>(value: T) -> Selfwhere
Self: UintTryFrom<T>,
pub fn from<T>(value: T) -> Selfwhere
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);Sourcepub fn saturating_from<T>(value: T) -> Selfwhere
Self: UintTryFrom<T>,
pub fn saturating_from<T>(value: T) -> Selfwhere
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);Sourcepub fn wrapping_from<T>(value: T) -> Selfwhere
Self: UintTryFrom<T>,
pub fn wrapping_from<T>(value: T) -> Selfwhere
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);Sourcepub fn wrapping_to<T>(&self) -> Twhere
Self: UintTryTo<T>,
pub fn wrapping_to<T>(&self) -> Twhere
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);Sourcepub fn saturating_to<T>(&self) -> Twhere
Self: UintTryTo<T>,
pub fn saturating_to<T>(&self) -> Twhere
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>
impl<const BITS: usize, const LIMBS: usize> Uint<BITS, LIMBS>
Sourcepub fn gcd_extended(self, other: Self) -> (Self, Self, Self, bool)
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>
impl<const BITS: usize, const LIMBS: usize> Uint<BITS, LIMBS>
Sourcepub fn checked_log(self, base: Self) -> Option<usize>
Available on crate feature std only.
pub fn checked_log(self, base: Self) -> Option<usize>
std only.Returns the logarithm of the number, rounded down.
Returns None if the base is less than two, or this number is zero.
Sourcepub fn checked_log10(self) -> Option<usize>
Available on crate feature std only.
pub fn checked_log10(self) -> Option<usize>
std only.Returns the base 10 logarithm of the number, rounded down.
Returns None if the number is zero.
Sourcepub fn checked_log2(self) -> Option<usize>
Available on crate feature std only.
pub fn checked_log2(self) -> Option<usize>
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.
Sourcepub fn log(self, base: Self) -> usize
Available on crate feature std only.
pub fn log(self, base: Self) -> usize
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.
Sourcepub fn log10(self) -> usize
Available on crate feature std only.
pub fn log10(self) -> usize
std only.Returns the base 10 logarithm of the number, rounded down.
§Panics
Panics if the base if the number is zero.
Sourcepub fn log2(self) -> usize
Available on crate feature std only.
pub fn log2(self) -> usize
std only.Returns the base 2 logarithm of the number, rounded down.
§Panics
Panics if the base if the number is zero.
Sourcepub fn approx_log(self, base: f64) -> f64
Available on crate feature std only.
pub fn approx_log(self, base: f64) -> f64
std only.Double precision logarithm.
Sourcepub fn approx_log2(self) -> f64
Available on crate feature std only.
pub fn approx_log2(self) -> f64
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);Sourcepub fn approx_log10(self) -> f64
Available on crate feature std only.
pub fn approx_log10(self) -> f64
std only.Double precision decimal logarithm.
Source§impl<const BITS: usize, const LIMBS: usize> Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> Uint<BITS, LIMBS>
Sourcepub fn reduce_mod(self, modulus: Self) -> Self
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.
Sourcepub fn add_mod(self, rhs: Self, modulus: Self) -> Self
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.
Sourcepub fn mul_mod(self, rhs: Self, modulus: Self) -> Self
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.
Sourcepub fn pow_mod(self, exp: Self, modulus: Self) -> Self
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.
Sourcepub fn inv_mod(self, modulus: Self) -> Option<Self>
pub fn inv_mod(self, modulus: Self) -> Option<Self>
Compute $\mod{\mathtt{self}^{-1}}_{\mathtt{modulus}}$.
Returns None if the inverse does not exist.
Sourcepub fn mul_redc(self, other: Self, modulus: Self, inv: u64) -> Self
pub fn mul_redc(self, other: Self, modulus: Self, inv: u64) -> Self
Montgomery multiplication.
Requires self and other to be less than modulus.
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 in debug mode.
Sourcepub fn square_redc(self, modulus: Self, inv: u64) -> Self
pub fn square_redc(self, modulus: Self, inv: u64) -> Self
Montgomery squaring.
See Self::mul_redc.
Source§impl<const BITS: usize, const LIMBS: usize> Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> Uint<BITS, LIMBS>
Sourcepub fn checked_mul(self, rhs: Self) -> Option<Self>
pub fn checked_mul(self, rhs: Self) -> Option<Self>
Computes self * rhs, returning None if overflow occurred.
Sourcepub fn overflowing_mul(self, rhs: Self) -> (Self, bool)
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)
);Sourcepub fn saturating_mul(self, rhs: Self) -> Self
pub fn saturating_mul(self, rhs: Self) -> Self
Computes self * rhs, saturating at the numeric bounds instead of
overflowing.
Sourcepub fn wrapping_mul(self, rhs: Self) -> Self
pub fn wrapping_mul(self, rhs: Self) -> Self
Computes self * rhs, wrapping around at the boundary of the type.
Sourcepub fn inv_ring(self) -> Option<Self>
pub fn inv_ring(self) -> Option<Self>
Computes the inverse modulo $2^{\mathtt{BITS}}$ of self, returning
None if the inverse does not exist.
Sourcepub 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>
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>
impl<const BITS: usize, const LIMBS: usize> Uint<BITS, LIMBS>
Sourcepub fn checked_pow(self, exp: Self) -> Option<Self>
pub fn checked_pow(self, exp: Self) -> Option<Self>
Raises self to the power of exp.
Returns None if the result would overflow.
Sourcepub fn overflowing_pow(self, exp: Self) -> (Self, bool)
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));Sourcepub fn pow(self, exp: Self) -> Self
pub fn pow(self, exp: Self) -> Self
Raises self to the power of exp, wrapping around on overflow.
Sourcepub fn saturating_pow(self, exp: Self) -> Self
pub fn saturating_pow(self, exp: Self) -> Self
Raises self to the power of exp, saturating on overflow.
Sourcepub fn wrapping_pow(self, exp: Self) -> Self
pub fn wrapping_pow(self, exp: Self) -> Self
Raises self to the power of exp, wrapping around on overflow.
Sourcepub fn approx_pow2(exp: f64) -> Option<Self>
Available on crate feature std only.
pub fn approx_pow2(exp: f64) -> Option<Self>
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>
impl<const BITS: usize, const LIMBS: usize> Uint<BITS, LIMBS>
Sourcepub fn root(self, degree: usize) -> Self
Available on crate feature std only.
pub fn root(self, degree: usize) -> Self
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>
impl<const BITS: usize, const LIMBS: usize> Uint<BITS, LIMBS>
Sourcepub const fn is_power_of_two(self) -> bool
pub const fn is_power_of_two(self) -> bool
Returns true if and only if self == 2^k for some k.
Sourcepub const fn next_power_of_two(self) -> Self
pub const 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.
Sourcepub const fn checked_next_power_of_two(self) -> Option<Self>
pub const 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);Sourcepub fn next_multiple_of(self, rhs: Self) -> Self
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.
Sourcepub fn checked_next_multiple_of(self, rhs: Self) -> Option<Self>
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>
impl<const BITS: usize, const LIMBS: usize> Uint<BITS, LIMBS>
Sourcepub fn from_str_radix(src: &str, radix: u64) -> Result<Self, ParseError>
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
ParseError::InvalidDigitif the string contains a non-digit.ParseError::InvalidRadixif the radix is larger than 64.ParseError::BaseConvertErrorifUint::from_base_befails.
Source§impl<const BITS: usize, const LIMBS: usize> Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> Uint<BITS, LIMBS>
Sourcepub fn random() -> Self
Available on crate features rand-09 and std only.
pub fn random() -> Self
rand-09 and std only.Creates a new Uint with the default cryptographic random number
generator.
This is currently rand::rng().
Sourcepub fn random_with<R: RngCore + ?Sized>(rng: &mut R) -> Self
Available on crate feature rand-09 only.
pub fn random_with<R: RngCore + ?Sized>(rng: &mut R) -> Self
rand-09 only.Creates a new Uint with the given random number generator.
Source§impl<const BITS: usize, const LIMBS: usize> Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> Uint<BITS, LIMBS>
Sourcepub const ONE: Self
pub const ONE: Self
The value one. This is useful to have as a constant for use in const fn.
Zero if BITS is zero.
Sourcepub const MIN: Self = Self::ZERO
pub const MIN: Self = Self::ZERO
The smallest value that can be represented by this integer type.
Synonym for Self::ZERO.
Sourcepub const MAX: Self
pub const MAX: Self
The largest value that can be represented by this integer type, $2^{\mathtt{BITS}} − 1$.
Sourcepub const unsafe fn as_limbs_mut(&mut self) -> &mut [u64; LIMBS]
pub const 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.
Sourcepub const fn into_limbs(self) -> [u64; LIMBS]
pub const fn into_limbs(self) -> [u64; LIMBS]
Convert to a array of limbs.
Limbs are least significant first.
Sourcepub const fn from_limbs(limbs: [u64; LIMBS]) -> Self
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 too large for the bit-size of the Uint.
Sourcepub fn from_limbs_slice(slice: &[u64]) -> Self
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 too large for the bit-size of the Uint.
Sourcepub fn checked_from_limbs_slice(slice: &[u64]) -> Option<Self>
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.
Sourcepub fn wrapping_from_limbs_slice(slice: &[u64]) -> Self
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.
Sourcepub fn overflowing_from_limbs_slice(slice: &[u64]) -> (Self, bool)
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.
Sourcepub fn saturating_from_limbs_slice(slice: &[u64]) -> Self
pub fn saturating_from_limbs_slice(slice: &[u64]) -> Self
Trait Implementations§
Source§impl<const BITS: usize, const LIMBS: usize> AddAssign<&Uint<BITS, LIMBS>> for Uint<BITS, LIMBS>
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>)
fn add_assign(&mut self, rhs: &Uint<BITS, LIMBS>)
+= operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> AddAssign for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> AddAssign for Uint<BITS, LIMBS>
Source§fn add_assign(&mut self, rhs: Uint<BITS, LIMBS>)
fn add_assign(&mut self, rhs: Uint<BITS, LIMBS>)
+= operation. Read moreSource§impl<'a, const BITS: usize, const LIMBS: usize> Arbitrary<'a> for Uint<BITS, LIMBS>
Available on crate feature arbitrary only.
impl<'a, const BITS: usize, const LIMBS: usize> Arbitrary<'a> for Uint<BITS, LIMBS>
arbitrary only.Source§fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
Self from the given unstructured data. Read moreSource§fn size_hint(_depth: usize) -> (usize, Option<usize>)
fn size_hint(_depth: usize) -> (usize, Option<usize>)
Unstructured this type
needs to construct itself. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
Self from the entirety of the given
unstructured data. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Unstructured this type
needs to construct itself. Read moreSource§impl<const BITS: usize, const LIMBS: usize> Arbitrary for Uint<BITS, LIMBS>
Available on crate feature proptest only.
impl<const BITS: usize, const LIMBS: usize> Arbitrary for Uint<BITS, LIMBS>
proptest only.Source§type Parameters = ()
type Parameters = ()
arbitrary_with accepts for configuration
of the generated Strategy. Parameters must implement Default.Source§type Strategy = Map<<[u64; LIMBS] as Arbitrary>::Strategy, fn([u64; LIMBS]) -> Uint<BITS, LIMBS>>
type Strategy = Map<<[u64; LIMBS] as Arbitrary>::Strategy, fn([u64; LIMBS]) -> Uint<BITS, LIMBS>>
Strategy used to generate values of type Self.Source§fn arbitrary_with((): Self::Parameters) -> Self::Strategy
fn arbitrary_with((): Self::Parameters) -> Self::Strategy
Source§impl<const BITS: usize, const LIMBS: usize> Arbitrary for Uint<BITS, LIMBS>
Available on crate feature quickcheck only.
impl<const BITS: usize, const LIMBS: usize> Arbitrary for Uint<BITS, LIMBS>
quickcheck only.Source§impl<const BITS: usize, const LIMBS: usize> Archive for Uint<BITS, LIMBS>
Available on crate feature rkyv only.
impl<const BITS: usize, const LIMBS: usize> Archive for Uint<BITS, LIMBS>
rkyv only.Source§type Archived = ArchivedUint<BITS, LIMBS>
type Archived = ArchivedUint<BITS, LIMBS>
Source§type Resolver = [(); LIMBS]
type Resolver = [(); LIMBS]
Source§fn resolve(&self, resolver: Self::Resolver, out: Place<Self::Archived>)
fn resolve(&self, resolver: Self::Resolver, out: Place<Self::Archived>)
Source§const COPY_OPTIMIZATION: CopyOptimization<Self> = _
const COPY_OPTIMIZATION: CopyOptimization<Self> = _
serialize. Read moreSource§impl<const BITS: usize, const LIMBS: usize> AsExpression<Binary> for &Uint<BITS, LIMBS>
Available on crate feature diesel only.
impl<const BITS: usize, const LIMBS: usize> AsExpression<Binary> for &Uint<BITS, LIMBS>
diesel only.Source§type Expression = Bound<Binary, &Uint<BITS, LIMBS>>
type Expression = Bound<Binary, &Uint<BITS, LIMBS>>
Source§fn as_expression(self) -> Self::Expression
fn as_expression(self) -> Self::Expression
Source§impl<const BITS: usize, const LIMBS: usize> AsExpression<Binary> for Uint<BITS, LIMBS>
Available on crate feature diesel only.
impl<const BITS: usize, const LIMBS: usize> AsExpression<Binary> for Uint<BITS, LIMBS>
diesel only.Source§type Expression = Bound<Binary, Uint<BITS, LIMBS>>
type Expression = Bound<Binary, Uint<BITS, LIMBS>>
Source§fn as_expression(self) -> Self::Expression
fn as_expression(self) -> Self::Expression
Source§impl<const BITS: usize, const LIMBS: usize> AsExpression<Nullable<Binary>> for &Uint<BITS, LIMBS>
Available on crate feature diesel only.
impl<const BITS: usize, const LIMBS: usize> AsExpression<Nullable<Binary>> for &Uint<BITS, LIMBS>
diesel only.Source§fn as_expression(self) -> Self::Expression
fn as_expression(self) -> Self::Expression
Source§impl<const BITS: usize, const LIMBS: usize> AsExpression<Nullable<Binary>> for Uint<BITS, LIMBS>
Available on crate feature diesel only.
impl<const BITS: usize, const LIMBS: usize> AsExpression<Nullable<Binary>> for Uint<BITS, LIMBS>
diesel only.Source§fn as_expression(self) -> Self::Expression
fn as_expression(self) -> Self::Expression
Source§impl<const BITS: usize, const LIMBS: usize> BitAnd<&Uint<BITS, LIMBS>> for &Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> BitAnd<&Uint<BITS, LIMBS>> for &Uint<BITS, LIMBS>
Source§impl<const BITS: usize, const LIMBS: usize> BitAndAssign<&Uint<BITS, LIMBS>> for Uint<BITS, LIMBS>
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>)
fn bitand_assign(&mut self, rhs: &Uint<BITS, LIMBS>)
&= operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> BitAndAssign for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> BitAndAssign for Uint<BITS, LIMBS>
Source§fn bitand_assign(&mut self, rhs: Uint<BITS, LIMBS>)
fn bitand_assign(&mut self, rhs: Uint<BITS, LIMBS>)
&= operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> BitOrAssign<&Uint<BITS, LIMBS>> for Uint<BITS, LIMBS>
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>)
fn bitor_assign(&mut self, rhs: &Uint<BITS, LIMBS>)
|= operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> BitOrAssign for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> BitOrAssign for Uint<BITS, LIMBS>
Source§fn bitor_assign(&mut self, rhs: Uint<BITS, LIMBS>)
fn bitor_assign(&mut self, rhs: Uint<BITS, LIMBS>)
|= operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> BitXor<&Uint<BITS, LIMBS>> for &Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> BitXor<&Uint<BITS, LIMBS>> for &Uint<BITS, LIMBS>
Source§impl<const BITS: usize, const LIMBS: usize> BitXorAssign<&Uint<BITS, LIMBS>> for Uint<BITS, LIMBS>
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>)
fn bitxor_assign(&mut self, rhs: &Uint<BITS, LIMBS>)
^= operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> BitXorAssign for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> BitXorAssign for Uint<BITS, LIMBS>
Source§fn bitxor_assign(&mut self, rhs: Uint<BITS, LIMBS>)
fn bitxor_assign(&mut self, rhs: Uint<BITS, LIMBS>)
^= operation. Read moreSource§impl<'de, Context, const BITS: usize, const LIMBS: usize> BorrowDecode<'de, Context> for Uint<BITS, LIMBS>
Available on crate feature bincode-2 only.
impl<'de, Context, const BITS: usize, const LIMBS: usize> BorrowDecode<'de, Context> for Uint<BITS, LIMBS>
bincode-2 only.Source§fn borrow_decode<D: BorrowDecoder<'de, Context = Context>>(
decoder: &mut D,
) -> Result<Self, DecodeError>
fn borrow_decode<D: BorrowDecoder<'de, Context = Context>>( decoder: &mut D, ) -> Result<Self, DecodeError>
Source§impl<const BITS: usize, const LIMBS: usize> BorshDeserialize for Uint<BITS, LIMBS>
Available on crate feature borsh only.
impl<const BITS: usize, const LIMBS: usize> BorshDeserialize for Uint<BITS, LIMBS>
borsh only.fn deserialize_reader<R: Read>(reader: &mut R) -> Result<Self>
Source§fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
Source§fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>where
R: Read,
Source§impl<const BITS: usize, const LIMBS: usize> BorshSerialize for Uint<BITS, LIMBS>
Available on crate feature borsh only.
impl<const BITS: usize, const LIMBS: usize> BorshSerialize for Uint<BITS, LIMBS>
borsh only.Source§impl<const BITS: usize, const LIMBS: usize> Bounded for Uint<BITS, LIMBS>
Available on crate feature num-traits only.
impl<const BITS: usize, const LIMBS: usize> Bounded for Uint<BITS, LIMBS>
num-traits only.Source§impl<const BITS: usize, const LIMBS: usize> CheckedAdd for Uint<BITS, LIMBS>
Available on crate feature num-traits only.
impl<const BITS: usize, const LIMBS: usize> CheckedAdd for Uint<BITS, LIMBS>
num-traits only.Source§fn checked_add(&self, other: &Self) -> Option<Self>
fn checked_add(&self, other: &Self) -> Option<Self>
None is
returned.Source§impl<const BITS: usize, const LIMBS: usize> CheckedDiv for Uint<BITS, LIMBS>
Available on crate feature num-traits only.
impl<const BITS: usize, const LIMBS: usize> CheckedDiv for Uint<BITS, LIMBS>
num-traits only.Source§fn checked_div(&self, other: &Self) -> Option<Self>
fn checked_div(&self, other: &Self) -> Option<Self>
None is returned.Source§impl<const BITS: usize, const LIMBS: usize> CheckedEuclid for Uint<BITS, LIMBS>
Available on crate feature num-traits only.
impl<const BITS: usize, const LIMBS: usize> CheckedEuclid for Uint<BITS, LIMBS>
num-traits only.Source§fn checked_div_euclid(&self, v: &Self) -> Option<Self>
fn checked_div_euclid(&self, v: &Self) -> Option<Self>
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>
fn checked_rem_euclid(&self, v: &Self) -> Option<Self>
None is returned.Source§fn checked_div_rem_euclid(&self, v: &Self) -> Option<(Self, Self)>
fn checked_div_rem_euclid(&self, v: &Self) -> Option<(Self, Self)>
Source§impl<const BITS: usize, const LIMBS: usize> CheckedMul for Uint<BITS, LIMBS>
Available on crate feature num-traits only.
impl<const BITS: usize, const LIMBS: usize> CheckedMul for Uint<BITS, LIMBS>
num-traits only.Source§fn checked_mul(&self, other: &Self) -> Option<Self>
fn checked_mul(&self, other: &Self) -> Option<Self>
None is returned.Source§impl<const BITS: usize, const LIMBS: usize> CheckedNeg for Uint<BITS, LIMBS>
Available on crate feature num-traits only.
impl<const BITS: usize, const LIMBS: usize> CheckedNeg for Uint<BITS, LIMBS>
num-traits only.Source§fn checked_neg(&self) -> Option<Self>
fn checked_neg(&self) -> Option<Self>
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 moreSource§impl<const BITS: usize, const LIMBS: usize> CheckedRem for Uint<BITS, LIMBS>
Available on crate feature num-traits only.
impl<const BITS: usize, const LIMBS: usize> CheckedRem for Uint<BITS, LIMBS>
num-traits only.Source§fn checked_rem(&self, other: &Self) -> Option<Self>
fn checked_rem(&self, other: &Self) -> Option<Self>
None is returned. Read moreSource§impl<const BITS: usize, const LIMBS: usize> CheckedShl for Uint<BITS, LIMBS>
Available on crate feature num-traits only.
impl<const BITS: usize, const LIMBS: usize> CheckedShl for Uint<BITS, LIMBS>
num-traits only.Source§impl<const BITS: usize, const LIMBS: usize> CheckedShr for Uint<BITS, LIMBS>
Available on crate feature num-traits only.
impl<const BITS: usize, const LIMBS: usize> CheckedShr for Uint<BITS, LIMBS>
num-traits only.Source§impl<const BITS: usize, const LIMBS: usize> CheckedSub for Uint<BITS, LIMBS>
Available on crate feature num-traits only.
impl<const BITS: usize, const LIMBS: usize> CheckedSub for Uint<BITS, LIMBS>
num-traits only.Source§fn checked_sub(&self, other: &Self) -> Option<Self>
fn checked_sub(&self, other: &Self) -> Option<Self>
None is returned.Source§impl<const BITS: usize, const LIMBS: usize> ConditionallySelectable for Uint<BITS, LIMBS>
Available on crate feature subtle only.
impl<const BITS: usize, const LIMBS: usize> ConditionallySelectable for Uint<BITS, LIMBS>
subtle only.Source§fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Self
fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Self
Source§fn conditional_assign(&mut self, other: &Self, choice: Choice)
fn conditional_assign(&mut self, other: &Self, choice: Choice)
Source§fn conditional_swap(a: &mut Self, b: &mut Self, choice: Choice)
fn conditional_swap(a: &mut Self, b: &mut Self, choice: Choice)
self and other if choice == 1; otherwise,
reassign both unto themselves. Read moreSource§impl<const BITS: usize, const LIMBS: usize> ConstantTimeEq for Uint<BITS, LIMBS>
Available on crate feature subtle only.
impl<const BITS: usize, const LIMBS: usize> ConstantTimeEq for Uint<BITS, LIMBS>
subtle only.Source§impl<const BITS: usize, const LIMBS: usize> ConstantTimeGreater for Uint<BITS, LIMBS>
Available on crate feature subtle only.
impl<const BITS: usize, const LIMBS: usize> ConstantTimeGreater for Uint<BITS, LIMBS>
subtle only.Source§impl<const BITS: usize, const LIMBS: usize> ConstantTimeLess for Uint<BITS, LIMBS>
Available on crate feature subtle only.
impl<const BITS: usize, const LIMBS: usize> ConstantTimeLess for Uint<BITS, LIMBS>
subtle only.Source§impl<const BITS: usize, const LIMBS: usize> Decodable for Uint<BITS, LIMBS>
Available on crate feature alloy-rlp only.Allows a Uint to be deserialized from RLP.
impl<const BITS: usize, const LIMBS: usize> Decodable for Uint<BITS, LIMBS>
alloy-rlp only.Allows a Uint to be deserialized from RLP.
Source§impl<const BITS: usize, const LIMBS: usize> Decodable for Uint<BITS, LIMBS>
Available on crate feature fastrlp only.Allows a Uint to be deserialized from RLP.
impl<const BITS: usize, const LIMBS: usize> Decodable for Uint<BITS, LIMBS>
fastrlp only.Allows a Uint to be deserialized from RLP.
Source§impl<const BITS: usize, const LIMBS: usize> Decodable for Uint<BITS, LIMBS>
Available on crate feature fastrlp-04 only.Allows a Uint to be deserialized from RLP.
impl<const BITS: usize, const LIMBS: usize> Decodable for Uint<BITS, LIMBS>
fastrlp-04 only.Allows a Uint to be deserialized from RLP.
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.
impl<const BITS: usize, const LIMBS: usize> Decodable for Uint<BITS, LIMBS>
rlp only.Allows a Uint to be deserialized from RLP.
Source§impl<'a, const BITS: usize, const LIMBS: usize, DB: Database> Decode<'a, DB> for Uint<BITS, LIMBS>
Available on crate feature sqlx only.
impl<'a, const BITS: usize, const LIMBS: usize, DB: Database> Decode<'a, DB> for Uint<BITS, LIMBS>
sqlx only.Source§impl<Context, const BITS: usize, const LIMBS: usize> Decode<Context> for Uint<BITS, LIMBS>
Available on crate feature bincode-2 only.
impl<Context, const BITS: usize, const LIMBS: usize> Decode<Context> for Uint<BITS, LIMBS>
bincode-2 only.Source§impl<const BITS: usize, const LIMBS: usize> Decode for Uint<BITS, LIMBS>
Available on crate feature parity-scale-codec only.
impl<const BITS: usize, const LIMBS: usize> Decode for Uint<BITS, LIMBS>
parity-scale-codec only.Source§fn decode<I: Input>(input: &mut I) -> Result<Self, Error>
fn decode<I: Input>(input: &mut I) -> Result<Self, Error>
Source§fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>,
) -> Result<DecodeFinished, Error>where
I: Input,
fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>,
) -> Result<DecodeFinished, Error>where
I: Input,
Source§impl<const BITS: usize, const LIMBS: usize> Decode for Uint<BITS, LIMBS>
Available on crate feature ssz only.
impl<const BITS: usize, const LIMBS: usize> Decode for Uint<BITS, LIMBS>
ssz only.Source§fn is_ssz_fixed_len() -> bool
fn is_ssz_fixed_len() -> bool
true if this object has a fixed-length. Read moreSource§fn ssz_fixed_len() -> usize
fn ssz_fixed_len() -> usize
Source§fn from_ssz_bytes(bytes: &[u8]) -> Result<Self, DecodeError>
fn from_ssz_bytes(bytes: &[u8]) -> Result<Self, DecodeError>
Source§impl<'a, const BITS: usize, const LIMBS: usize> DecodeValue<'a> for Uint<BITS, LIMBS>
Available on crate feature der only.
impl<'a, const BITS: usize, const LIMBS: usize> DecodeValue<'a> for Uint<BITS, LIMBS>
der only.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 Uint.
impl<'de, const BITS: usize, const LIMBS: usize> Deserialize<'de> for Uint<BITS, LIMBS>
serde only.Deserialize human readable hex strings or byte arrays into Uint.
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>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Source§impl<D: Fallible + ?Sized, const BITS: usize, const LIMBS: usize> Deserialize<Uint<BITS, LIMBS>, D> for Archived<Uint<BITS, LIMBS>>
Available on crate feature rkyv only.
impl<D: Fallible + ?Sized, const BITS: usize, const LIMBS: usize> Deserialize<Uint<BITS, LIMBS>, D> for Archived<Uint<BITS, LIMBS>>
rkyv only.Source§impl<const BITS: usize, const LIMBS: usize> Distribution<Uint<BITS, LIMBS>> for Standard
Available on crate feature rand only.
impl<const BITS: usize, const LIMBS: usize> Distribution<Uint<BITS, LIMBS>> for Standard
rand only.Source§fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Uint<BITS, LIMBS>
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Uint<BITS, LIMBS>
T, using rng as the source of randomness.Source§fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
T, using rng as
the source of randomness. Read moreSource§impl<const BITS: usize, const LIMBS: usize> Distribution<Uint<BITS, LIMBS>> for StandardUniform
Available on crate feature rand-09 only.
impl<const BITS: usize, const LIMBS: usize> Distribution<Uint<BITS, LIMBS>> for StandardUniform
rand-09 only.Source§fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Uint<BITS, LIMBS>
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Uint<BITS, LIMBS>
T, using rng as the source of randomness.Source§fn sample_iter<R>(self, rng: R) -> Iter<Self, R, T>
fn sample_iter<R>(self, rng: R) -> Iter<Self, R, T>
T, using rng as
the source of randomness. Read moreSource§impl<const BITS: usize, const LIMBS: usize> DivAssign<&Uint<BITS, LIMBS>> for Uint<BITS, LIMBS>
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>)
fn div_assign(&mut self, rhs: &Uint<BITS, LIMBS>)
/= operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> DivAssign for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> DivAssign for Uint<BITS, LIMBS>
Source§fn div_assign(&mut self, rhs: Uint<BITS, LIMBS>)
fn div_assign(&mut self, rhs: Uint<BITS, LIMBS>)
/= operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> Encodable for Uint<BITS, LIMBS>
Available on crate feature alloy-rlp only.Allows a Uint to be serialized as RLP.
impl<const BITS: usize, const LIMBS: usize> Encodable for Uint<BITS, LIMBS>
alloy-rlp only.Allows a Uint to be serialized as RLP.
Source§impl<const BITS: usize, const LIMBS: usize> Encodable for Uint<BITS, LIMBS>
Available on crate feature fastrlp only.Allows a Uint to be serialized as RLP.
impl<const BITS: usize, const LIMBS: usize> Encodable for Uint<BITS, LIMBS>
fastrlp only.Allows a Uint to be serialized as RLP.
Source§impl<const BITS: usize, const LIMBS: usize> Encodable for Uint<BITS, LIMBS>
Available on crate feature fastrlp-04 only.Allows a Uint to be serialized as RLP.
impl<const BITS: usize, const LIMBS: usize> Encodable for Uint<BITS, LIMBS>
fastrlp-04 only.Allows a Uint to be serialized as RLP.
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.
impl<const BITS: usize, const LIMBS: usize> Encodable for Uint<BITS, LIMBS>
rlp only.Allows a Uint to be serialized as RLP.
Source§impl<'a, const BITS: usize, const LIMBS: usize, DB: Database> Encode<'a, DB> for Uint<BITS, LIMBS>
Available on crate feature sqlx only.
impl<'a, const BITS: usize, const LIMBS: usize, DB: Database> Encode<'a, DB> for Uint<BITS, LIMBS>
sqlx only.Source§fn encode_by_ref(
&self,
buf: &mut <DB as Database>::ArgumentBuffer<'a>,
) -> Result<IsNull, BoxDynError>
fn encode_by_ref( &self, buf: &mut <DB as Database>::ArgumentBuffer<'a>, ) -> Result<IsNull, BoxDynError>
Source§fn encode(
self,
buf: &mut <DB as Database>::ArgumentBuffer<'q>,
) -> Result<IsNull, Box<dyn Error + Send + Sync>>where
Self: Sized,
fn encode(
self,
buf: &mut <DB as Database>::ArgumentBuffer<'q>,
) -> Result<IsNull, Box<dyn Error + Send + Sync>>where
Self: Sized,
self into buf in the expected format for the database.fn produces(&self) -> Option<<DB as Database>::TypeInfo>
fn size_hint(&self) -> usize
Source§impl<const BITS: usize, const LIMBS: usize> Encode for Uint<BITS, LIMBS>
Available on crate feature bincode-2 only.
impl<const BITS: usize, const LIMBS: usize> Encode for Uint<BITS, LIMBS>
bincode-2 only.Source§impl<const BITS: usize, const LIMBS: usize> Encode for Uint<BITS, LIMBS>
Available on crate feature parity-scale-codec only.
impl<const BITS: usize, const LIMBS: usize> Encode for Uint<BITS, LIMBS>
parity-scale-codec only.Source§fn size_hint(&self) -> usize
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
fn using_encoded<R, F: FnOnce(&[u8]) -> R>(&self, f: F) -> R
Source§fn encode_to<T>(&self, dest: &mut T)
fn encode_to<T>(&self, dest: &mut T)
Source§fn encoded_size(&self) -> usize
fn encoded_size(&self) -> usize
Source§impl<const BITS: usize, const LIMBS: usize> Encode for Uint<BITS, LIMBS>
Available on crate feature ssz only.
impl<const BITS: usize, const LIMBS: usize> Encode for Uint<BITS, LIMBS>
ssz only.Source§fn is_ssz_fixed_len() -> bool
fn is_ssz_fixed_len() -> bool
true if this object has a fixed-length. Read moreSource§fn ssz_fixed_len() -> usize
fn ssz_fixed_len() -> usize
Source§fn ssz_bytes_len(&self) -> usize
fn ssz_bytes_len(&self) -> usize
self is serialized. Read moreSource§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.
impl<'a, const BITS: usize, const LIMBS: usize> EncodeAsRef<'a, Uint<BITS, LIMBS>> for CompactUint<BITS, LIMBS>
parity-scale-codec only.Source§type RefType = CompactRefUint<'a, BITS, LIMBS>
type RefType = CompactRefUint<'a, BITS, LIMBS>
Source§impl<const BITS: usize, const LIMBS: usize> EncodeValue for Uint<BITS, LIMBS>
Available on crate feature der only.
impl<const BITS: usize, const LIMBS: usize> EncodeValue for Uint<BITS, LIMBS>
der only.Source§impl<const BITS: usize, const LIMBS: usize> Euclid for Uint<BITS, LIMBS>
Available on crate feature num-traits only.
impl<const BITS: usize, const LIMBS: usize> Euclid for Uint<BITS, LIMBS>
num-traits only.Source§fn div_euclid(&self, v: &Self) -> Self
fn div_euclid(&self, v: &Self) -> Self
rem_euclid. Read moreSource§fn rem_euclid(&self, v: &Self) -> Self
fn rem_euclid(&self, v: &Self) -> Self
self (mod v). Read moreSource§fn div_rem_euclid(&self, v: &Self) -> (Self, Self)
fn div_rem_euclid(&self, v: &Self) -> (Self, Self)
Source§impl<const BITS: usize, const LIMBS: usize> FixedTag for Uint<BITS, LIMBS>
Available on crate feature der only.
impl<const BITS: usize, const LIMBS: usize> FixedTag for Uint<BITS, LIMBS>
der only.Source§impl<'a, const BITS: usize, const LIMBS: usize> From<&'a ArchivedUint<BITS, LIMBS>> for Uint<BITS, LIMBS>
Available on crate feature rkyv only.
impl<'a, const BITS: usize, const LIMBS: usize> From<&'a ArchivedUint<BITS, LIMBS>> for Uint<BITS, LIMBS>
rkyv only.Source§fn from(archived: &'a ArchivedUint<BITS, LIMBS>) -> Self
fn from(archived: &'a ArchivedUint<BITS, LIMBS>) -> Self
Source§impl<const BITS: usize, const LIMBS: usize> From<&BigInt<LIMBS>> for Uint<BITS, LIMBS>
Available on crate feature ark-ff-04 only.
impl<const BITS: usize, const LIMBS: usize> From<&BigInt<LIMBS>> for Uint<BITS, LIMBS>
ark-ff-04 only.Source§impl<const BITS: usize, const LIMBS: usize> From<&BigInt<LIMBS>> for Uint<BITS, LIMBS>
Available on crate feature ark-ff-05 only.
impl<const BITS: usize, const LIMBS: usize> From<&BigInt<LIMBS>> for Uint<BITS, LIMBS>
ark-ff-05 only.Source§impl From<&BigInteger128> for Uint<128, 2>
Available on crate feature ark-ff only.
impl From<&BigInteger128> for Uint<128, 2>
ark-ff only.Source§fn from(value: &BigInteger128) -> Self
fn from(value: &BigInteger128) -> Self
Source§impl From<&BigInteger256> for Uint<256, 4>
Available on crate feature ark-ff only.
impl From<&BigInteger256> for Uint<256, 4>
ark-ff only.Source§fn from(value: &BigInteger256) -> Self
fn from(value: &BigInteger256) -> Self
Source§impl From<&BigInteger320> for Uint<320, 5>
Available on crate feature ark-ff only.
impl From<&BigInteger320> for Uint<320, 5>
ark-ff only.Source§fn from(value: &BigInteger320) -> Self
fn from(value: &BigInteger320) -> Self
Source§impl From<&BigInteger384> for Uint<384, 6>
Available on crate feature ark-ff only.
impl From<&BigInteger384> for Uint<384, 6>
ark-ff only.Source§fn from(value: &BigInteger384) -> Self
fn from(value: &BigInteger384) -> Self
Source§impl From<&BigInteger448> for Uint<448, 7>
Available on crate feature ark-ff only.
impl From<&BigInteger448> for Uint<448, 7>
ark-ff only.Source§fn from(value: &BigInteger448) -> Self
fn from(value: &BigInteger448) -> Self
Source§impl From<&BigInteger64> for Uint<64, 1>
Available on crate feature ark-ff only.
impl From<&BigInteger64> for Uint<64, 1>
ark-ff only.Source§fn from(value: &BigInteger64) -> Self
fn from(value: &BigInteger64) -> Self
Source§impl From<&BigInteger768> for Uint<768, 12>
Available on crate feature ark-ff only.
impl From<&BigInteger768> for Uint<768, 12>
ark-ff only.Source§fn from(value: &BigInteger768) -> Self
fn from(value: &BigInteger768) -> Self
Source§impl From<&BigInteger832> for Uint<832, 13>
Available on crate feature ark-ff only.
impl From<&BigInteger832> for Uint<832, 13>
ark-ff only.Source§fn from(value: &BigInteger832) -> Self
fn from(value: &BigInteger832) -> Self
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.
impl<P: FpConfig<LIMBS>, const BITS: usize, const LIMBS: usize> From<&Fp<P, LIMBS>> for Uint<BITS, LIMBS>
ark-ff-04 only.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-05 only.
impl<P: FpConfig<LIMBS>, const BITS: usize, const LIMBS: usize> From<&Fp<P, LIMBS>> for Uint<BITS, LIMBS>
ark-ff-05 only.Source§impl<P: Fp256Parameters> From<&Fp256<P>> for Uint<256, 4>
Available on crate feature ark-ff only.
impl<P: Fp256Parameters> From<&Fp256<P>> for Uint<256, 4>
ark-ff only.Source§impl<P: Fp320Parameters> From<&Fp320<P>> for Uint<320, 5>
Available on crate feature ark-ff only.
impl<P: Fp320Parameters> From<&Fp320<P>> for Uint<320, 5>
ark-ff only.Source§impl<P: Fp384Parameters> From<&Fp384<P>> for Uint<384, 6>
Available on crate feature ark-ff only.
impl<P: Fp384Parameters> From<&Fp384<P>> for Uint<384, 6>
ark-ff only.Source§impl<P: Fp448Parameters> From<&Fp448<P>> for Uint<448, 7>
Available on crate feature ark-ff only.
impl<P: Fp448Parameters> From<&Fp448<P>> for Uint<448, 7>
ark-ff only.Source§impl<P: Fp64Parameters> From<&Fp64<P>> for Uint<64, 1>
Available on crate feature ark-ff only.
impl<P: Fp64Parameters> From<&Fp64<P>> for Uint<64, 1>
ark-ff only.Source§impl<P: Fp768Parameters> From<&Fp768<P>> for Uint<768, 12>
Available on crate feature ark-ff only.
impl<P: Fp768Parameters> From<&Fp768<P>> for Uint<768, 12>
ark-ff only.Source§impl<P: Fp832Parameters> From<&Fp832<P>> for Uint<832, 13>
Available on crate feature ark-ff only.
impl<P: Fp832Parameters> From<&Fp832<P>> for Uint<832, 13>
ark-ff only.Source§impl From<&Uint<128, 2>> for BigInteger128
Available on crate feature ark-ff only.
impl From<&Uint<128, 2>> for BigInteger128
ark-ff only.Source§impl From<&Uint<256, 4>> for BigInteger256
Available on crate feature ark-ff only.
impl From<&Uint<256, 4>> for BigInteger256
ark-ff only.Source§impl From<&Uint<320, 5>> for BigInteger320
Available on crate feature ark-ff only.
impl From<&Uint<320, 5>> for BigInteger320
ark-ff only.Source§impl From<&Uint<384, 6>> for BigInteger384
Available on crate feature ark-ff only.
impl From<&Uint<384, 6>> for BigInteger384
ark-ff only.Source§impl From<&Uint<448, 7>> for BigInteger448
Available on crate feature ark-ff only.
impl From<&Uint<448, 7>> for BigInteger448
ark-ff only.Source§impl From<&Uint<64, 1>> for BigInteger64
Available on crate feature ark-ff only.
impl From<&Uint<64, 1>> for BigInteger64
ark-ff only.Source§impl From<&Uint<768, 12>> for BigInteger768
Available on crate feature ark-ff only.
impl From<&Uint<768, 12>> for BigInteger768
ark-ff only.Source§impl From<&Uint<832, 13>> for BigInteger832
Available on crate feature ark-ff only.
impl From<&Uint<832, 13>> for BigInteger832
ark-ff only.Source§impl<const BITS: usize, const LIMBS: usize> From<&Uint<BITS, LIMBS>> for Any
Available on crate feature der only.
impl<const BITS: usize, const LIMBS: usize> From<&Uint<BITS, LIMBS>> for Any
der only.Source§impl<const BITS: usize, const LIMBS: usize> From<&Uint<BITS, LIMBS>> for BN
Available on crate feature bn-rs only.
impl<const BITS: usize, const LIMBS: usize> From<&Uint<BITS, LIMBS>> for BN
bn-rs only.Source§impl<const BITS: usize, const LIMBS: usize> From<&Uint<BITS, LIMBS>> for BigInt
Available on crate feature num-bigint only.
impl<const BITS: usize, const LIMBS: usize> From<&Uint<BITS, LIMBS>> for BigInt
num-bigint only.Source§impl<const BITS: usize, const LIMBS: usize> From<&Uint<BITS, LIMBS>> for BigInt<LIMBS>
Available on crate feature ark-ff-04 only.
impl<const BITS: usize, const LIMBS: usize> From<&Uint<BITS, LIMBS>> for BigInt<LIMBS>
ark-ff-04 only.Source§impl<const BITS: usize, const LIMBS: usize> From<&Uint<BITS, LIMBS>> for BigInt<LIMBS>
Available on crate feature ark-ff-05 only.
impl<const BITS: usize, const LIMBS: usize> From<&Uint<BITS, LIMBS>> for BigInt<LIMBS>
ark-ff-05 only.Source§impl<const BITS: usize, const LIMBS: usize> From<&Uint<BITS, LIMBS>> for BigNumber
Available on crate feature bn-rs only.
impl<const BITS: usize, const LIMBS: usize> From<&Uint<BITS, LIMBS>> for BigNumber
bn-rs only.Source§impl<const BITS: usize, const LIMBS: usize> From<&Uint<BITS, LIMBS>> for BigUint
Available on crate feature num-bigint only.
impl<const BITS: usize, const LIMBS: usize> From<&Uint<BITS, LIMBS>> for BigUint
num-bigint only.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.
impl<'a, const BITS: usize, const LIMBS: usize> From<&'a Uint<BITS, LIMBS>> for CompactRefUint<'a, BITS, LIMBS>
parity-scale-codec only.Source§impl<const BITS: usize, const LIMBS: usize> From<&Uint<BITS, LIMBS>> for Int
Available on crate feature der only.
impl<const BITS: usize, const LIMBS: usize> From<&Uint<BITS, LIMBS>> for Int
der only.Source§impl<const BITS: usize, const LIMBS: usize> From<&Uint<BITS, LIMBS>> for Uint
Available on crate feature der only.
impl<const BITS: usize, const LIMBS: usize> From<&Uint<BITS, LIMBS>> for Uint
der only.Source§impl<const BITS: usize, const LIMBS: usize> From<ArchivedUint<BITS, LIMBS>> for Uint<BITS, LIMBS>
Available on crate feature rkyv only.
impl<const BITS: usize, const LIMBS: usize> From<ArchivedUint<BITS, LIMBS>> for Uint<BITS, LIMBS>
rkyv only.Source§fn from(archived: ArchivedUint<BITS, LIMBS>) -> Self
fn from(archived: ArchivedUint<BITS, LIMBS>) -> Self
Source§impl<const BITS: usize, const LIMBS: usize> From<BigInt<LIMBS>> for Uint<BITS, LIMBS>
Available on crate feature ark-ff-04 only.
impl<const BITS: usize, const LIMBS: usize> From<BigInt<LIMBS>> for Uint<BITS, LIMBS>
ark-ff-04 only.Source§impl<const BITS: usize, const LIMBS: usize> From<BigInt<LIMBS>> for Uint<BITS, LIMBS>
Available on crate feature ark-ff-05 only.
impl<const BITS: usize, const LIMBS: usize> From<BigInt<LIMBS>> for Uint<BITS, LIMBS>
ark-ff-05 only.Source§impl From<BigInteger128> for Uint<128, 2>
Available on crate feature ark-ff only.
impl From<BigInteger128> for Uint<128, 2>
ark-ff only.Source§fn from(value: BigInteger128) -> Self
fn from(value: BigInteger128) -> Self
Source§impl From<BigInteger256> for Uint<256, 4>
Available on crate feature ark-ff only.
impl From<BigInteger256> for Uint<256, 4>
ark-ff only.Source§fn from(value: BigInteger256) -> Self
fn from(value: BigInteger256) -> Self
Source§impl From<BigInteger320> for Uint<320, 5>
Available on crate feature ark-ff only.
impl From<BigInteger320> for Uint<320, 5>
ark-ff only.Source§fn from(value: BigInteger320) -> Self
fn from(value: BigInteger320) -> Self
Source§impl From<BigInteger384> for Uint<384, 6>
Available on crate feature ark-ff only.
impl From<BigInteger384> for Uint<384, 6>
ark-ff only.Source§fn from(value: BigInteger384) -> Self
fn from(value: BigInteger384) -> Self
Source§impl From<BigInteger448> for Uint<448, 7>
Available on crate feature ark-ff only.
impl From<BigInteger448> for Uint<448, 7>
ark-ff only.Source§fn from(value: BigInteger448) -> Self
fn from(value: BigInteger448) -> Self
Source§impl From<BigInteger64> for Uint<64, 1>
Available on crate feature ark-ff only.
impl From<BigInteger64> for Uint<64, 1>
ark-ff only.Source§fn from(value: BigInteger64) -> Self
fn from(value: BigInteger64) -> Self
Source§impl From<BigInteger768> for Uint<768, 12>
Available on crate feature ark-ff only.
impl From<BigInteger768> for Uint<768, 12>
ark-ff only.Source§fn from(value: BigInteger768) -> Self
fn from(value: BigInteger768) -> Self
Source§impl From<BigInteger832> for Uint<832, 13>
Available on crate feature ark-ff only.
impl From<BigInteger832> for Uint<832, 13>
ark-ff only.Source§fn from(value: BigInteger832) -> Self
fn from(value: BigInteger832) -> Self
Source§impl<const BITS: usize, const LIMBS: usize> From<CompactUint<BITS, LIMBS>> for Uint<BITS, LIMBS>
Available on crate feature parity-scale-codec only.
impl<const BITS: usize, const LIMBS: usize> From<CompactUint<BITS, LIMBS>> for Uint<BITS, LIMBS>
parity-scale-codec only.Source§fn from(v: CompactUint<BITS, LIMBS>) -> Self
fn from(v: CompactUint<BITS, LIMBS>) -> Self
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.
impl<P: FpConfig<LIMBS>, const BITS: usize, const LIMBS: usize> From<Fp<P, LIMBS>> for Uint<BITS, LIMBS>
ark-ff-04 only.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-05 only.
impl<P: FpConfig<LIMBS>, const BITS: usize, const LIMBS: usize> From<Fp<P, LIMBS>> for Uint<BITS, LIMBS>
ark-ff-05 only.Source§impl<P: Fp256Parameters> From<Fp256<P>> for Uint<256, 4>
Available on crate feature ark-ff only.
impl<P: Fp256Parameters> From<Fp256<P>> for Uint<256, 4>
ark-ff only.Source§impl<P: Fp320Parameters> From<Fp320<P>> for Uint<320, 5>
Available on crate feature ark-ff only.
impl<P: Fp320Parameters> From<Fp320<P>> for Uint<320, 5>
ark-ff only.Source§impl<P: Fp384Parameters> From<Fp384<P>> for Uint<384, 6>
Available on crate feature ark-ff only.
impl<P: Fp384Parameters> From<Fp384<P>> for Uint<384, 6>
ark-ff only.Source§impl<P: Fp448Parameters> From<Fp448<P>> for Uint<448, 7>
Available on crate feature ark-ff only.
impl<P: Fp448Parameters> From<Fp448<P>> for Uint<448, 7>
ark-ff only.Source§impl<P: Fp768Parameters> From<Fp768<P>> for Uint<768, 12>
Available on crate feature ark-ff only.
impl<P: Fp768Parameters> From<Fp768<P>> for Uint<768, 12>
ark-ff only.Source§impl<P: Fp832Parameters> From<Fp832<P>> for Uint<832, 13>
Available on crate feature ark-ff only.
impl<P: Fp832Parameters> From<Fp832<P>> for Uint<832, 13>
ark-ff only.Source§impl From<Uint<128, 2>> for BigInteger128
Available on crate feature ark-ff only.
impl From<Uint<128, 2>> for BigInteger128
ark-ff only.Source§impl From<Uint<256, 4>> for BigInteger256
Available on crate feature ark-ff only.
impl From<Uint<256, 4>> for BigInteger256
ark-ff only.Source§impl From<Uint<320, 5>> for BigInteger320
Available on crate feature ark-ff only.
impl From<Uint<320, 5>> for BigInteger320
ark-ff only.Source§impl From<Uint<384, 6>> for BigInteger384
Available on crate feature ark-ff only.
impl From<Uint<384, 6>> for BigInteger384
ark-ff only.Source§impl From<Uint<448, 7>> for BigInteger448
Available on crate feature ark-ff only.
impl From<Uint<448, 7>> for BigInteger448
ark-ff only.Source§impl From<Uint<64, 1>> for BigInteger64
Available on crate feature ark-ff only.
impl From<Uint<64, 1>> for BigInteger64
ark-ff only.Source§impl From<Uint<768, 12>> for BigInteger768
Available on crate feature ark-ff only.
impl From<Uint<768, 12>> for BigInteger768
ark-ff only.Source§impl From<Uint<832, 13>> for BigInteger832
Available on crate feature ark-ff only.
impl From<Uint<832, 13>> for BigInteger832
ark-ff only.Source§impl<const BITS: usize, const LIMBS: usize> From<Uint<BITS, LIMBS>> for Any
Available on crate feature der only.
impl<const BITS: usize, const LIMBS: usize> From<Uint<BITS, LIMBS>> for Any
der only.Source§impl<const BITS: usize, const LIMBS: usize> From<Uint<BITS, LIMBS>> for BN
Available on crate feature bn-rs only.
impl<const BITS: usize, const LIMBS: usize> From<Uint<BITS, LIMBS>> for BN
bn-rs only.Source§impl<const BITS: usize, const LIMBS: usize> From<Uint<BITS, LIMBS>> for BigDecimal
Available on crate feature bigdecimal only.
impl<const BITS: usize, const LIMBS: usize> From<Uint<BITS, LIMBS>> for BigDecimal
bigdecimal only.Source§impl<const BITS: usize, const LIMBS: usize> From<Uint<BITS, LIMBS>> for BigInt
Available on crate feature num-bigint only.
impl<const BITS: usize, const LIMBS: usize> From<Uint<BITS, LIMBS>> for BigInt
num-bigint only.Source§impl<const BITS: usize, const LIMBS: usize> From<Uint<BITS, LIMBS>> for BigInt<LIMBS>
Available on crate feature ark-ff-04 only.
impl<const BITS: usize, const LIMBS: usize> From<Uint<BITS, LIMBS>> for BigInt<LIMBS>
ark-ff-04 only.Source§impl<const BITS: usize, const LIMBS: usize> From<Uint<BITS, LIMBS>> for BigInt<LIMBS>
Available on crate feature ark-ff-05 only.
impl<const BITS: usize, const LIMBS: usize> From<Uint<BITS, LIMBS>> for BigInt<LIMBS>
ark-ff-05 only.Source§impl<const BITS: usize, const LIMBS: usize> From<Uint<BITS, LIMBS>> for BigNumber
Available on crate feature bn-rs only.
impl<const BITS: usize, const LIMBS: usize> From<Uint<BITS, LIMBS>> for BigNumber
bn-rs only.Source§impl<const BITS: usize, const LIMBS: usize> From<Uint<BITS, LIMBS>> for BigUint
Available on crate feature num-bigint only.
impl<const BITS: usize, const LIMBS: usize> From<Uint<BITS, LIMBS>> for BigUint
num-bigint only.Source§impl<const BITS: usize, const LIMBS: usize> From<Uint<BITS, LIMBS>> for CompactUint<BITS, LIMBS>
Available on crate feature parity-scale-codec only.
impl<const BITS: usize, const LIMBS: usize> From<Uint<BITS, LIMBS>> for CompactUint<BITS, LIMBS>
parity-scale-codec only.Source§impl<const BITS: usize, const LIMBS: usize> From<Uint<BITS, LIMBS>> for Int
Available on crate feature der only.
impl<const BITS: usize, const LIMBS: usize> From<Uint<BITS, LIMBS>> for Int
der only.Source§impl<const BITS: usize, const LIMBS: usize> From<Uint<BITS, LIMBS>> for Uint
Available on crate feature der only.
impl<const BITS: usize, const LIMBS: usize> From<Uint<BITS, LIMBS>> for Uint
der only.Source§impl<const BITS: usize, const LIMBS: usize> FromBytes for Uint<BITS, LIMBS>
Available on crate feature num-traits only.
impl<const BITS: usize, const LIMBS: usize> FromBytes for Uint<BITS, LIMBS>
num-traits only.type Bytes = [u8]
Source§fn from_le_bytes(bytes: &[u8]) -> Self
fn from_le_bytes(bytes: &[u8]) -> Self
Source§fn from_be_bytes(bytes: &[u8]) -> Self
fn from_be_bytes(bytes: &[u8]) -> Self
Source§fn from_ne_bytes(bytes: &Self::Bytes) -> Self
fn from_ne_bytes(bytes: &Self::Bytes) -> Self
Source§impl<const BITS: usize, const LIMBS: usize> FromPrimitive for Uint<BITS, LIMBS>
Available on crate feature num-traits only.
impl<const BITS: usize, const LIMBS: usize> FromPrimitive for Uint<BITS, LIMBS>
num-traits only.Source§fn from_i64(n: i64) -> Option<Self>
fn from_i64(n: i64) -> Option<Self>
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>
fn from_u64(n: u64) -> Option<Self>
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>
fn from_i128(n: i128) -> Option<Self>
i128 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned. Read moreSource§fn from_u128(n: u128) -> Option<Self>
fn from_u128(n: u128) -> Option<Self>
u128 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned. Read moreSource§fn from_isize(n: isize) -> Option<Self>
fn from_isize(n: isize) -> Option<Self>
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>
fn from_i8(n: i8) -> Option<Self>
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>
fn from_i16(n: i16) -> Option<Self>
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>
fn from_i32(n: i32) -> Option<Self>
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>
fn from_usize(n: usize) -> Option<Self>
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>
fn from_u8(n: u8) -> Option<Self>
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>
fn from_u16(n: u16) -> Option<Self>
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>
fn from_u32(n: u32) -> Option<Self>
u32 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned.Source§impl<'a, const BITS: usize, const LIMBS: usize> FromPyObject<'a> for Uint<BITS, LIMBS>
Available on crate feature pyo3 only.
impl<'a, const BITS: usize, const LIMBS: usize> FromPyObject<'a> for Uint<BITS, LIMBS>
pyo3 only.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.
impl<'a, const BITS: usize, const LIMBS: usize> FromSql<'a> for Uint<BITS, LIMBS>
postgres only.Convert from Postgres types.
See ToSql for details.
Source§fn accepts(ty: &Type) -> bool
fn accepts(ty: &Type) -> bool
Type.Source§fn from_sql(
ty: &Type,
raw: &'a [u8],
) -> Result<Self, Box<dyn Error + Sync + Send>>
fn from_sql( ty: &Type, raw: &'a [u8], ) -> Result<Self, Box<dyn Error + Sync + Send>>
Type in its binary format. Read moreSource§impl<const BITS: usize, const LIMBS: usize, Db: Backend> FromSql<Binary, Db> for Uint<BITS, LIMBS>
Available on crate feature diesel only.
impl<const BITS: usize, const LIMBS: usize, Db: Backend> FromSql<Binary, Db> for Uint<BITS, LIMBS>
diesel only.Source§impl<const BITS: usize, const LIMBS: usize> HasCompact for Uint<BITS, LIMBS>
Available on crate feature parity-scale-codec only.
impl<const BITS: usize, const LIMBS: usize> HasCompact for Uint<BITS, LIMBS>
parity-scale-codec only.Source§type Type = CompactUint<BITS, LIMBS>
type Type = CompactUint<BITS, LIMBS>
Source§impl<const BITS: usize, const LIMBS: usize> Integer for Uint<BITS, LIMBS>
Available on crate feature num-integer only.
impl<const BITS: usize, const LIMBS: usize> Integer for Uint<BITS, LIMBS>
num-integer only.Source§fn is_multiple_of(&self, other: &Self) -> bool
fn is_multiple_of(&self, other: &Self) -> bool
Source§fn div_rem(&self, other: &Self) -> (Self, Self)
fn div_rem(&self, other: &Self) -> (Self, Self)
(quotient, remainder). Read moreSource§fn div_mod_floor(&self, other: &Self) -> (Self, Self)
fn div_mod_floor(&self, other: &Self) -> (Self, Self)
(quotient, remainder). Read moreSource§fn extended_gcd(&self, other: &Self) -> ExtendedGcd<Self>
fn extended_gcd(&self, other: &Self) -> ExtendedGcd<Self>
Source§fn gcd_lcm(&self, other: &Self) -> (Self, Self)
fn gcd_lcm(&self, other: &Self) -> (Self, Self)
Source§fn divides(&self, other: &Self) -> bool
fn divides(&self, other: &Self) -> bool
Please use is_multiple_of instead
is_multiple_of instead.Source§fn next_multiple_of(&self, other: &Self) -> Selfwhere
Self: Clone,
fn next_multiple_of(&self, other: &Self) -> Selfwhere
Self: Clone,
Source§fn prev_multiple_of(&self, other: &Self) -> Selfwhere
Self: Clone,
fn prev_multiple_of(&self, other: &Self) -> Selfwhere
Self: Clone,
Source§impl<'a, const BITS: usize, const LIMBS: usize> IntoPyObject<'a> for &Uint<BITS, LIMBS>
Available on crate feature pyo3 only.
impl<'a, const BITS: usize, const LIMBS: usize> IntoPyObject<'a> for &Uint<BITS, LIMBS>
pyo3 only.Source§impl<'a, const BITS: usize, const LIMBS: usize> IntoPyObject<'a> for Uint<BITS, LIMBS>
Available on crate feature pyo3 only.
impl<'a, const BITS: usize, const LIMBS: usize> IntoPyObject<'a> for Uint<BITS, LIMBS>
pyo3 only.Source§impl<const BITS: usize, const LIMBS: usize> Inv for Uint<BITS, LIMBS>
Available on crate feature num-traits only.
impl<const BITS: usize, const LIMBS: usize> Inv for Uint<BITS, LIMBS>
num-traits only.Source§impl<const BITS: usize, const LIMBS: usize> MaxEncodedLen for Uint<BITS, LIMBS>
Available on crate feature parity-scale-codec only.
impl<const BITS: usize, const LIMBS: usize> MaxEncodedLen for Uint<BITS, LIMBS>
parity-scale-codec only.Source§fn max_encoded_len() -> usize
fn max_encoded_len() -> usize
Source§impl<const BITS: usize, const LIMBS: usize> MaxEncodedLenAssoc for Uint<BITS, LIMBS>
Available on crate feature alloy-rlp only.
impl<const BITS: usize, const LIMBS: usize> MaxEncodedLenAssoc for Uint<BITS, LIMBS>
alloy-rlp only.Source§impl<const BITS: usize, const LIMBS: usize> MulAdd for Uint<BITS, LIMBS>
Available on crate feature num-traits only.
impl<const BITS: usize, const LIMBS: usize> MulAdd for Uint<BITS, LIMBS>
num-traits only.Source§impl<const BITS: usize, const LIMBS: usize> MulAddAssign for Uint<BITS, LIMBS>
Available on crate feature num-traits only.
impl<const BITS: usize, const LIMBS: usize> MulAddAssign for Uint<BITS, LIMBS>
num-traits only.Source§fn mul_add_assign(&mut self, a: Self, b: Self)
fn mul_add_assign(&mut self, a: Self, b: Self)
*self = (*self * a) + bSource§impl<const BITS: usize, const LIMBS: usize> MulAssign<&Uint<BITS, LIMBS>> for Uint<BITS, LIMBS>
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>)
fn mul_assign(&mut self, rhs: &Uint<BITS, LIMBS>)
*= operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> MulAssign for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> MulAssign for Uint<BITS, LIMBS>
Source§fn mul_assign(&mut self, rhs: Uint<BITS, LIMBS>)
fn mul_assign(&mut self, rhs: Uint<BITS, LIMBS>)
*= operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> Num for Uint<BITS, LIMBS>
Available on crate feature num-traits only.
impl<const BITS: usize, const LIMBS: usize> Num for Uint<BITS, LIMBS>
num-traits only.type FromStrRadixErr = ParseError
Source§fn from_str_radix(str: &str, radix: u32) -> Result<Self, Self::FromStrRadixErr>
fn from_str_radix(str: &str, radix: u32) -> Result<Self, Self::FromStrRadixErr>
2..=36). Read moreSource§impl<const BITS: usize, const LIMBS: usize> NumCast for Uint<BITS, LIMBS>
Available on crate feature num-traits only.
impl<const BITS: usize, const LIMBS: usize> NumCast for Uint<BITS, LIMBS>
num-traits only.Source§impl<const BITS: usize, const LIMBS: usize> One for Uint<BITS, LIMBS>
Available on crate feature num-traits only.
impl<const BITS: usize, const LIMBS: usize> One for Uint<BITS, LIMBS>
num-traits only.Source§impl<const BITS: usize, const LIMBS: usize> Ord for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> Ord for Uint<BITS, LIMBS>
Source§impl<const BITS: usize, const LIMBS: usize> OverflowingAdd for Uint<BITS, LIMBS>
Available on crate feature num-traits only.
impl<const BITS: usize, const LIMBS: usize> OverflowingAdd for Uint<BITS, LIMBS>
num-traits only.Source§fn overflowing_add(&self, v: &Self) -> (Self, bool)
fn overflowing_add(&self, v: &Self) -> (Self, bool)
Source§impl<const BITS: usize, const LIMBS: usize> OverflowingMul for Uint<BITS, LIMBS>
Available on crate feature num-traits only.
impl<const BITS: usize, const LIMBS: usize> OverflowingMul for Uint<BITS, LIMBS>
num-traits only.Source§fn overflowing_mul(&self, v: &Self) -> (Self, bool)
fn overflowing_mul(&self, v: &Self) -> (Self, bool)
Source§impl<const BITS: usize, const LIMBS: usize> OverflowingSub for Uint<BITS, LIMBS>
Available on crate feature num-traits only.
impl<const BITS: usize, const LIMBS: usize> OverflowingSub for Uint<BITS, LIMBS>
num-traits only.Source§fn overflowing_sub(&self, v: &Self) -> (Self, bool)
fn overflowing_sub(&self, v: &Self) -> (Self, bool)
Source§impl<const BITS: usize, const LIMBS: usize> PartialOrd<i128> for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> PartialOrd<i128> for Uint<BITS, LIMBS>
Source§impl<const BITS: usize, const LIMBS: usize> PartialOrd<i16> for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> PartialOrd<i16> for Uint<BITS, LIMBS>
Source§impl<const BITS: usize, const LIMBS: usize> PartialOrd<i32> for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> PartialOrd<i32> for Uint<BITS, LIMBS>
Source§impl<const BITS: usize, const LIMBS: usize> PartialOrd<i64> for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> PartialOrd<i64> for Uint<BITS, LIMBS>
Source§impl<const BITS: usize, const LIMBS: usize> PartialOrd<i8> for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> PartialOrd<i8> for Uint<BITS, LIMBS>
Source§impl<const BITS: usize, const LIMBS: usize> PartialOrd<isize> for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> PartialOrd<isize> for Uint<BITS, LIMBS>
Source§impl<const BITS: usize, const LIMBS: usize> PartialOrd<u128> for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> PartialOrd<u128> for Uint<BITS, LIMBS>
Source§impl<const BITS: usize, const LIMBS: usize> PartialOrd<u16> for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> PartialOrd<u16> for Uint<BITS, LIMBS>
Source§impl<const BITS: usize, const LIMBS: usize> PartialOrd<u32> for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> PartialOrd<u32> for Uint<BITS, LIMBS>
Source§impl<const BITS: usize, const LIMBS: usize> PartialOrd<u64> for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> PartialOrd<u64> for Uint<BITS, LIMBS>
Source§impl<const BITS: usize, const LIMBS: usize> PartialOrd<u8> for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> PartialOrd<u8> for Uint<BITS, LIMBS>
Source§impl<const BITS: usize, const LIMBS: usize> PartialOrd<usize> for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> PartialOrd<usize> for Uint<BITS, LIMBS>
Source§impl<const BITS: usize, const LIMBS: usize> PartialOrd for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> PartialOrd for Uint<BITS, LIMBS>
Source§impl<const BITS: usize, const LIMBS: usize> Pow<Uint<BITS, LIMBS>> for Uint<BITS, LIMBS>
Available on crate feature num-traits only.
impl<const BITS: usize, const LIMBS: usize> Pow<Uint<BITS, LIMBS>> for Uint<BITS, LIMBS>
num-traits only.Source§impl<const BITS: usize, const LIMBS: usize> PrimInt for Uint<BITS, LIMBS>
Available on crate feature num-traits only.
impl<const BITS: usize, const LIMBS: usize> PrimInt for Uint<BITS, LIMBS>
num-traits only.Source§fn swap_bytes(self) -> Self
fn swap_bytes(self) -> Self
Note: This is not well-defined when BITS % 8 != 0.
Source§fn count_ones(self) -> u32
fn count_ones(self) -> u32
self. Read moreSource§fn count_zeros(self) -> u32
fn count_zeros(self) -> u32
self. Read moreSource§fn leading_zeros(self) -> u32
fn leading_zeros(self) -> u32
self. Read moreSource§fn leading_ones(self) -> u32
fn leading_ones(self) -> u32
self. Read moreSource§fn trailing_zeros(self) -> u32
fn trailing_zeros(self) -> u32
self. Read moreSource§fn trailing_ones(self) -> u32
fn trailing_ones(self) -> u32
self. Read moreSource§fn rotate_left(self, n: u32) -> Self
fn rotate_left(self, n: u32) -> Self
n, wrapping
the truncated bits to the end of the resulting integer. Read moreSource§fn rotate_right(self, n: u32) -> Self
fn rotate_right(self, n: u32) -> Self
n, wrapping
the truncated bits to the beginning of the resulting integer. Read moreSource§fn signed_shl(self, n: u32) -> Self
fn signed_shl(self, n: u32) -> Self
n, filling
zeros in the least significant bits. Read moreSource§fn signed_shr(self, n: u32) -> Self
fn signed_shr(self, n: u32) -> Self
n, copying
the “sign bit” in the most significant bits even for unsigned types. Read moreSource§fn unsigned_shl(self, n: u32) -> Self
fn unsigned_shl(self, n: u32) -> Self
n, filling
zeros in the least significant bits. Read moreSource§fn unsigned_shr(self, n: u32) -> Self
fn unsigned_shr(self, n: u32) -> Self
n, filling
zeros in the most significant bits. Read moreSource§fn reverse_bits(self) -> Self
fn reverse_bits(self) -> Self
Source§fn from_be(x: Self) -> Self
fn from_be(x: Self) -> Self
Source§impl<'a, const BITS: usize, const LIMBS: usize> Product<&'a Uint<BITS, LIMBS>> for Uint<BITS, LIMBS>
impl<'a, const BITS: usize, const LIMBS: usize> Product<&'a Uint<BITS, LIMBS>> for Uint<BITS, LIMBS>
Source§impl<const BITS: usize, const LIMBS: usize, Db, St> Queryable<St, Db> for Uint<BITS, LIMBS>
Available on crate feature diesel only.
impl<const BITS: usize, const LIMBS: usize, Db, St> Queryable<St, Db> for Uint<BITS, LIMBS>
diesel only.Source§impl<const BITS: usize, const LIMBS: usize> RemAssign<&Uint<BITS, LIMBS>> for Uint<BITS, LIMBS>
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>)
fn rem_assign(&mut self, rhs: &Uint<BITS, LIMBS>)
%= operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> RemAssign for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> RemAssign for Uint<BITS, LIMBS>
Source§fn rem_assign(&mut self, rhs: Uint<BITS, LIMBS>)
fn rem_assign(&mut self, rhs: Uint<BITS, LIMBS>)
%= operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> Saturating for Uint<BITS, LIMBS>
Available on crate feature num-traits only.
impl<const BITS: usize, const LIMBS: usize> Saturating for Uint<BITS, LIMBS>
num-traits only.Source§fn saturating_add(self, v: Self) -> Self
fn saturating_add(self, v: Self) -> Self
Source§fn saturating_sub(self, v: Self) -> Self
fn saturating_sub(self, v: Self) -> Self
Source§impl<const BITS: usize, const LIMBS: usize> SaturatingAdd for Uint<BITS, LIMBS>
Available on crate feature num-traits only.
impl<const BITS: usize, const LIMBS: usize> SaturatingAdd for Uint<BITS, LIMBS>
num-traits only.Source§fn saturating_add(&self, v: &Self) -> Self
fn saturating_add(&self, v: &Self) -> Self
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.
impl<const BITS: usize, const LIMBS: usize> SaturatingMul for Uint<BITS, LIMBS>
num-traits only.Source§fn saturating_mul(&self, v: &Self) -> Self
fn saturating_mul(&self, v: &Self) -> Self
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.
impl<const BITS: usize, const LIMBS: usize> SaturatingSub for Uint<BITS, LIMBS>
num-traits only.Source§fn saturating_sub(&self, v: &Self) -> Self
fn saturating_sub(&self, v: &Self) -> Self
self - other, saturating at the relevant high or low boundary of
the type.Source§impl<S: Fallible + ?Sized, const BITS: usize, const LIMBS: usize> Serialize<S> for Uint<BITS, LIMBS>
Available on crate feature rkyv only.
impl<S: Fallible + ?Sized, const BITS: usize, const LIMBS: usize> Serialize<S> for Uint<BITS, LIMBS>
rkyv only.Source§impl<const BITS: usize, const LIMBS: usize> Serialize for Uint<BITS, LIMBS>
Available on crate feature serde only.Serialize a Uint value.
impl<const BITS: usize, const LIMBS: usize> Serialize for Uint<BITS, LIMBS>
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§impl<const BITS: usize, const LIMBS: usize> ShlAssign<&Uint<BITS, LIMBS>> for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> ShlAssign<&Uint<BITS, LIMBS>> for Uint<BITS, LIMBS>
Source§fn shl_assign(&mut self, rhs: &Self)
fn shl_assign(&mut self, rhs: &Self)
<<= operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> ShlAssign<&i16> for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> ShlAssign<&i16> for Uint<BITS, LIMBS>
Source§fn shl_assign(&mut self, rhs: &i16)
fn shl_assign(&mut self, rhs: &i16)
<<= operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> ShlAssign<&i32> for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> ShlAssign<&i32> for Uint<BITS, LIMBS>
Source§fn shl_assign(&mut self, rhs: &i32)
fn shl_assign(&mut self, rhs: &i32)
<<= operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> ShlAssign<&i64> for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> ShlAssign<&i64> for Uint<BITS, LIMBS>
Source§fn shl_assign(&mut self, rhs: &i64)
fn shl_assign(&mut self, rhs: &i64)
<<= operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> ShlAssign<&i8> for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> ShlAssign<&i8> for Uint<BITS, LIMBS>
Source§fn shl_assign(&mut self, rhs: &i8)
fn shl_assign(&mut self, rhs: &i8)
<<= operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> ShlAssign<&isize> for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> ShlAssign<&isize> for Uint<BITS, LIMBS>
Source§fn shl_assign(&mut self, rhs: &isize)
fn shl_assign(&mut self, rhs: &isize)
<<= operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> ShlAssign<&u16> for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> ShlAssign<&u16> for Uint<BITS, LIMBS>
Source§fn shl_assign(&mut self, rhs: &u16)
fn shl_assign(&mut self, rhs: &u16)
<<= operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> ShlAssign<&u32> for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> ShlAssign<&u32> for Uint<BITS, LIMBS>
Source§fn shl_assign(&mut self, rhs: &u32)
fn shl_assign(&mut self, rhs: &u32)
<<= operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> ShlAssign<&u64> for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> ShlAssign<&u64> for Uint<BITS, LIMBS>
Source§fn shl_assign(&mut self, rhs: &u64)
fn shl_assign(&mut self, rhs: &u64)
<<= operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> ShlAssign<&u8> for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> ShlAssign<&u8> for Uint<BITS, LIMBS>
Source§fn shl_assign(&mut self, rhs: &u8)
fn shl_assign(&mut self, rhs: &u8)
<<= operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> ShlAssign<&usize> for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> ShlAssign<&usize> for Uint<BITS, LIMBS>
Source§fn shl_assign(&mut self, rhs: &usize)
fn shl_assign(&mut self, rhs: &usize)
<<= operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> ShlAssign<i16> for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> ShlAssign<i16> for Uint<BITS, LIMBS>
Source§fn shl_assign(&mut self, rhs: i16)
fn shl_assign(&mut self, rhs: i16)
<<= operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> ShlAssign<i32> for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> ShlAssign<i32> for Uint<BITS, LIMBS>
Source§fn shl_assign(&mut self, rhs: i32)
fn shl_assign(&mut self, rhs: i32)
<<= operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> ShlAssign<i64> for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> ShlAssign<i64> for Uint<BITS, LIMBS>
Source§fn shl_assign(&mut self, rhs: i64)
fn shl_assign(&mut self, rhs: i64)
<<= operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> ShlAssign<i8> for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> ShlAssign<i8> for Uint<BITS, LIMBS>
Source§fn shl_assign(&mut self, rhs: i8)
fn shl_assign(&mut self, rhs: i8)
<<= operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> ShlAssign<isize> for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> ShlAssign<isize> for Uint<BITS, LIMBS>
Source§fn shl_assign(&mut self, rhs: isize)
fn shl_assign(&mut self, rhs: isize)
<<= operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> ShlAssign<u16> for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> ShlAssign<u16> for Uint<BITS, LIMBS>
Source§fn shl_assign(&mut self, rhs: u16)
fn shl_assign(&mut self, rhs: u16)
<<= operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> ShlAssign<u32> for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> ShlAssign<u32> for Uint<BITS, LIMBS>
Source§fn shl_assign(&mut self, rhs: u32)
fn shl_assign(&mut self, rhs: u32)
<<= operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> ShlAssign<u64> for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> ShlAssign<u64> for Uint<BITS, LIMBS>
Source§fn shl_assign(&mut self, rhs: u64)
fn shl_assign(&mut self, rhs: u64)
<<= operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> ShlAssign<u8> for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> ShlAssign<u8> for Uint<BITS, LIMBS>
Source§fn shl_assign(&mut self, rhs: u8)
fn shl_assign(&mut self, rhs: u8)
<<= operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> ShlAssign<usize> for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> ShlAssign<usize> for Uint<BITS, LIMBS>
Source§fn shl_assign(&mut self, rhs: usize)
fn shl_assign(&mut self, rhs: usize)
<<= operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> ShlAssign for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> ShlAssign for Uint<BITS, LIMBS>
Source§fn shl_assign(&mut self, rhs: Self)
fn shl_assign(&mut self, rhs: Self)
<<= operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> ShrAssign<&Uint<BITS, LIMBS>> for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> ShrAssign<&Uint<BITS, LIMBS>> for Uint<BITS, LIMBS>
Source§fn shr_assign(&mut self, rhs: &Self)
fn shr_assign(&mut self, rhs: &Self)
>>= operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> ShrAssign<&i16> for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> ShrAssign<&i16> for Uint<BITS, LIMBS>
Source§fn shr_assign(&mut self, rhs: &i16)
fn shr_assign(&mut self, rhs: &i16)
>>= operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> ShrAssign<&i32> for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> ShrAssign<&i32> for Uint<BITS, LIMBS>
Source§fn shr_assign(&mut self, rhs: &i32)
fn shr_assign(&mut self, rhs: &i32)
>>= operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> ShrAssign<&i64> for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> ShrAssign<&i64> for Uint<BITS, LIMBS>
Source§fn shr_assign(&mut self, rhs: &i64)
fn shr_assign(&mut self, rhs: &i64)
>>= operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> ShrAssign<&i8> for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> ShrAssign<&i8> for Uint<BITS, LIMBS>
Source§fn shr_assign(&mut self, rhs: &i8)
fn shr_assign(&mut self, rhs: &i8)
>>= operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> ShrAssign<&isize> for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> ShrAssign<&isize> for Uint<BITS, LIMBS>
Source§fn shr_assign(&mut self, rhs: &isize)
fn shr_assign(&mut self, rhs: &isize)
>>= operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> ShrAssign<&u16> for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> ShrAssign<&u16> for Uint<BITS, LIMBS>
Source§fn shr_assign(&mut self, rhs: &u16)
fn shr_assign(&mut self, rhs: &u16)
>>= operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> ShrAssign<&u32> for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> ShrAssign<&u32> for Uint<BITS, LIMBS>
Source§fn shr_assign(&mut self, rhs: &u32)
fn shr_assign(&mut self, rhs: &u32)
>>= operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> ShrAssign<&u64> for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> ShrAssign<&u64> for Uint<BITS, LIMBS>
Source§fn shr_assign(&mut self, rhs: &u64)
fn shr_assign(&mut self, rhs: &u64)
>>= operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> ShrAssign<&u8> for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> ShrAssign<&u8> for Uint<BITS, LIMBS>
Source§fn shr_assign(&mut self, rhs: &u8)
fn shr_assign(&mut self, rhs: &u8)
>>= operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> ShrAssign<&usize> for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> ShrAssign<&usize> for Uint<BITS, LIMBS>
Source§fn shr_assign(&mut self, rhs: &usize)
fn shr_assign(&mut self, rhs: &usize)
>>= operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> ShrAssign<i16> for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> ShrAssign<i16> for Uint<BITS, LIMBS>
Source§fn shr_assign(&mut self, rhs: i16)
fn shr_assign(&mut self, rhs: i16)
>>= operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> ShrAssign<i32> for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> ShrAssign<i32> for Uint<BITS, LIMBS>
Source§fn shr_assign(&mut self, rhs: i32)
fn shr_assign(&mut self, rhs: i32)
>>= operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> ShrAssign<i64> for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> ShrAssign<i64> for Uint<BITS, LIMBS>
Source§fn shr_assign(&mut self, rhs: i64)
fn shr_assign(&mut self, rhs: i64)
>>= operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> ShrAssign<i8> for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> ShrAssign<i8> for Uint<BITS, LIMBS>
Source§fn shr_assign(&mut self, rhs: i8)
fn shr_assign(&mut self, rhs: i8)
>>= operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> ShrAssign<isize> for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> ShrAssign<isize> for Uint<BITS, LIMBS>
Source§fn shr_assign(&mut self, rhs: isize)
fn shr_assign(&mut self, rhs: isize)
>>= operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> ShrAssign<u16> for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> ShrAssign<u16> for Uint<BITS, LIMBS>
Source§fn shr_assign(&mut self, rhs: u16)
fn shr_assign(&mut self, rhs: u16)
>>= operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> ShrAssign<u32> for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> ShrAssign<u32> for Uint<BITS, LIMBS>
Source§fn shr_assign(&mut self, rhs: u32)
fn shr_assign(&mut self, rhs: u32)
>>= operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> ShrAssign<u64> for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> ShrAssign<u64> for Uint<BITS, LIMBS>
Source§fn shr_assign(&mut self, rhs: u64)
fn shr_assign(&mut self, rhs: u64)
>>= operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> ShrAssign<u8> for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> ShrAssign<u8> for Uint<BITS, LIMBS>
Source§fn shr_assign(&mut self, rhs: u8)
fn shr_assign(&mut self, rhs: u8)
>>= operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> ShrAssign<usize> for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> ShrAssign<usize> for Uint<BITS, LIMBS>
Source§fn shr_assign(&mut self, rhs: usize)
fn shr_assign(&mut self, rhs: usize)
>>= operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> ShrAssign for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> ShrAssign for Uint<BITS, LIMBS>
Source§fn shr_assign(&mut self, rhs: Self)
fn shr_assign(&mut self, rhs: Self)
>>= operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> Structable for Uint<BITS, LIMBS>
Available on crate feature valuable only.
impl<const BITS: usize, const LIMBS: usize> Structable for Uint<BITS, LIMBS>
valuable only.Source§fn definition(&self) -> StructDef<'_>
fn definition(&self) -> StructDef<'_>
Source§impl<const BITS: usize, const LIMBS: usize> SubAssign<&Uint<BITS, LIMBS>> for Uint<BITS, LIMBS>
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>)
fn sub_assign(&mut self, rhs: &Uint<BITS, LIMBS>)
-= operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> SubAssign for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> SubAssign for Uint<BITS, LIMBS>
Source§fn sub_assign(&mut self, rhs: Uint<BITS, LIMBS>)
fn sub_assign(&mut self, rhs: Uint<BITS, LIMBS>)
-= operation. Read moreSource§impl<'a, const BITS: usize, const LIMBS: usize> Sum<&'a Uint<BITS, LIMBS>> for Uint<BITS, LIMBS>
impl<'a, const BITS: usize, const LIMBS: usize> Sum<&'a Uint<BITS, LIMBS>> for Uint<BITS, LIMBS>
Source§impl<const BITS: usize, const LIMBS: usize> ToBytes for Uint<BITS, LIMBS>
Available on crate feature num-traits only.
impl<const BITS: usize, const LIMBS: usize> ToBytes for Uint<BITS, LIMBS>
num-traits only.type Bytes = Vec<u8>
Source§fn to_le_bytes(&self) -> Self::Bytes
fn to_le_bytes(&self) -> Self::Bytes
Source§fn to_be_bytes(&self) -> Self::Bytes
fn to_be_bytes(&self) -> Self::Bytes
Source§fn to_ne_bytes(&self) -> Self::Bytes
fn to_ne_bytes(&self) -> Self::Bytes
Source§impl<const BITS: usize, const LIMBS: usize> ToPrimitive for Uint<BITS, LIMBS>
Available on crate feature num-traits only.
impl<const BITS: usize, const LIMBS: usize> ToPrimitive for Uint<BITS, LIMBS>
num-traits only.Source§fn to_i64(&self) -> Option<i64>
fn to_i64(&self) -> Option<i64>
self to an i64. If the value cannot be
represented by an i64, then None is returned.Source§fn to_u64(&self) -> Option<u64>
fn to_u64(&self) -> Option<u64>
self to a u64. If the value cannot be
represented by a u64, then None is returned.Source§fn to_i128(&self) -> Option<i128>
fn to_i128(&self) -> Option<i128>
self to an i128. If the value cannot be
represented by an i128 (i64 under the default implementation), then
None is returned. Read moreSource§fn to_u128(&self) -> Option<u128>
fn to_u128(&self) -> Option<u128>
self to a u128. If the value cannot be
represented by a u128 (u64 under the default implementation), then
None is returned. Read moreSource§fn to_isize(&self) -> Option<isize>
fn to_isize(&self) -> Option<isize>
self to an isize. If the value cannot be
represented by an isize, then None is returned.Source§fn to_i8(&self) -> Option<i8>
fn to_i8(&self) -> Option<i8>
self to an i8. If the value cannot be
represented by an i8, then None is returned.Source§fn to_i16(&self) -> Option<i16>
fn to_i16(&self) -> Option<i16>
self to an i16. If the value cannot be
represented by an i16, then None is returned.Source§fn to_i32(&self) -> Option<i32>
fn to_i32(&self) -> Option<i32>
self to an i32. If the value cannot be
represented by an i32, then None is returned.Source§fn to_usize(&self) -> Option<usize>
fn to_usize(&self) -> Option<usize>
self to a usize. If the value cannot be
represented by a usize, then None is returned.Source§fn to_u8(&self) -> Option<u8>
fn to_u8(&self) -> Option<u8>
self to a u8. If the value cannot be
represented by a u8, then None is returned.Source§fn to_u16(&self) -> Option<u16>
fn to_u16(&self) -> Option<u16>
self to a u16. If the value cannot be
represented by a u16, then None is returned.Source§fn to_u32(&self) -> Option<u32>
fn to_u32(&self) -> Option<u32>
self to a u32. If the value cannot be
represented by a u32, then None is returned.Source§impl<const BITS: usize, const LIMBS: usize, Db> ToSql<Binary, Db> for Uint<BITS, LIMBS>where
for<'c> Db: Backend<BindCollector<'c> = RawBytesBindCollector<Db>>,
Available on crate feature diesel only.
impl<const BITS: usize, const LIMBS: usize, Db> ToSql<Binary, Db> for Uint<BITS, LIMBS>where
for<'c> Db: Backend<BindCollector<'c> = RawBytesBindCollector<Db>>,
diesel only.Source§impl<const BITS: usize, const LIMBS: usize, Db> ToSql<Nullable<Binary>, Db> for Uint<BITS, LIMBS>
Available on crate feature diesel only.
impl<const BITS: usize, const LIMBS: usize, Db> ToSql<Nullable<Binary>, Db> for Uint<BITS, LIMBS>
diesel only.Source§impl<const BITS: usize, const LIMBS: usize> ToSql for Uint<BITS, LIMBS>
Available on crate feature postgres only.Convert to Postgres types.
impl<const BITS: usize, const LIMBS: usize> ToSql for Uint<BITS, LIMBS>
postgres only.Convert to Postgres types.
Compatible Postgres data types are:
BOOL,SMALLINT,INTEGER,BIGINTwhich are 1, 16, 32 and 64 bit signed integers respectively.OIDwhich is a 32 bit unsigned integer.FLOAT,DOUBLE PRECISIONwhich are 32 and 64 bit floating point.DECIMALandNUMERIC, which are variable length.MONEYwhich is a 64 bit integer with two decimals.BYTEA,BIT,VARBITinterpreted as a big-endian binary number.CHAR,VARCHAR,TEXTas0x-prefixed big-endian hex strings.JSON,JSONBas 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
fn accepts(ty: &Type) -> bool
Type.Source§fn to_sql(
&self,
ty: &Type,
out: &mut BytesMut,
) -> Result<IsNull, Box<dyn Error + Sync + Send + 'static>>
fn to_sql( &self, ty: &Type, out: &mut BytesMut, ) -> Result<IsNull, Box<dyn Error + Sync + Send + 'static>>
self into the binary format of the specified
Postgres Type, appending it to out. Read moreSource§fn to_sql_checked(
&self,
ty: &Type,
out: &mut BytesMut,
) -> Result<IsNull, Box<dyn Error + Sync + Send>>
fn to_sql_checked( &self, ty: &Type, out: &mut BytesMut, ) -> Result<IsNull, Box<dyn Error + Sync + Send>>
Source§fn encode_format(&self, _ty: &Type) -> Format
fn encode_format(&self, _ty: &Type) -> Format
Source§impl<const BITS: usize, const LIMBS: usize> TryFrom<&Any> for Uint<BITS, LIMBS>
Available on crate feature der only.
impl<const BITS: usize, const LIMBS: usize> TryFrom<&Any> for Uint<BITS, LIMBS>
der only.Source§impl<const BITS: usize, const LIMBS: usize> TryFrom<&BN> for Uint<BITS, LIMBS>
Available on crate feature bn-rs only.
impl<const BITS: usize, const LIMBS: usize> TryFrom<&BN> for Uint<BITS, LIMBS>
bn-rs only.Source§impl<const BITS: usize, const LIMBS: usize> TryFrom<&BigInt> for Uint<BITS, LIMBS>
Available on crate feature num-bigint only.
impl<const BITS: usize, const LIMBS: usize> TryFrom<&BigInt> for Uint<BITS, LIMBS>
num-bigint only.Source§impl<const BITS: usize, const LIMBS: usize> TryFrom<&BigNumber> for Uint<BITS, LIMBS>
Available on crate feature bn-rs only.
impl<const BITS: usize, const LIMBS: usize> TryFrom<&BigNumber> for Uint<BITS, LIMBS>
bn-rs only.Source§impl<const BITS: usize, const LIMBS: usize> TryFrom<&BigUint> for Uint<BITS, LIMBS>
Available on crate feature num-bigint only.
impl<const BITS: usize, const LIMBS: usize> TryFrom<&BigUint> for Uint<BITS, LIMBS>
num-bigint only.Source§impl<const BITS: usize, const LIMBS: usize> TryFrom<&Int> for Uint<BITS, LIMBS>
Available on crate feature der only.
impl<const BITS: usize, const LIMBS: usize> TryFrom<&Int> for Uint<BITS, LIMBS>
der only.Source§impl<P: Fp256Parameters> TryFrom<&Uint<256, 4>> for Fp256<P>
Available on crate feature ark-ff only.
impl<P: Fp256Parameters> TryFrom<&Uint<256, 4>> for Fp256<P>
ark-ff only.Source§type Error = ToFieldError
type Error = ToFieldError
Source§impl<P: Fp320Parameters> TryFrom<&Uint<320, 5>> for Fp320<P>
Available on crate feature ark-ff only.
impl<P: Fp320Parameters> TryFrom<&Uint<320, 5>> for Fp320<P>
ark-ff only.Source§type Error = ToFieldError
type Error = ToFieldError
Source§impl<P: Fp384Parameters> TryFrom<&Uint<384, 6>> for Fp384<P>
Available on crate feature ark-ff only.
impl<P: Fp384Parameters> TryFrom<&Uint<384, 6>> for Fp384<P>
ark-ff only.Source§type Error = ToFieldError
type Error = ToFieldError
Source§impl<P: Fp448Parameters> TryFrom<&Uint<448, 7>> for Fp448<P>
Available on crate feature ark-ff only.
impl<P: Fp448Parameters> TryFrom<&Uint<448, 7>> for Fp448<P>
ark-ff only.Source§type Error = ToFieldError
type Error = ToFieldError
Source§impl<P: Fp64Parameters> TryFrom<&Uint<64, 1>> for Fp64<P>
Available on crate feature ark-ff only.
impl<P: Fp64Parameters> TryFrom<&Uint<64, 1>> for Fp64<P>
ark-ff only.Source§type Error = ToFieldError
type Error = ToFieldError
Source§impl<P: Fp768Parameters> TryFrom<&Uint<768, 12>> for Fp768<P>
Available on crate feature ark-ff only.
impl<P: Fp768Parameters> TryFrom<&Uint<768, 12>> for Fp768<P>
ark-ff only.Source§type Error = ToFieldError
type Error = ToFieldError
Source§impl<P: Fp832Parameters> TryFrom<&Uint<832, 13>> for Fp832<P>
Available on crate feature ark-ff only.
impl<P: Fp832Parameters> TryFrom<&Uint<832, 13>> for Fp832<P>
ark-ff only.Source§type Error = ToFieldError
type Error = ToFieldError
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.
impl<P: FpConfig<LIMBS>, const BITS: usize, const LIMBS: usize> TryFrom<&Uint<BITS, LIMBS>> for Fp<P, LIMBS>
ark-ff-04 only.Source§type Error = ToFieldError
type Error = ToFieldError
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-05 only.
impl<P: FpConfig<LIMBS>, const BITS: usize, const LIMBS: usize> TryFrom<&Uint<BITS, LIMBS>> for Fp<P, LIMBS>
ark-ff-05 only.Source§type Error = ToFieldError
type Error = ToFieldError
Source§impl<const BITS: usize, const LIMBS: usize> TryFrom<&Uint> for Uint<BITS, LIMBS>
Available on crate feature der only.
impl<const BITS: usize, const LIMBS: usize> TryFrom<&Uint> for Uint<BITS, LIMBS>
der only.Source§impl<const BITS: usize, const LIMBS: usize> TryFrom<Any> for Uint<BITS, LIMBS>
Available on crate feature der only.
impl<const BITS: usize, const LIMBS: usize> TryFrom<Any> for Uint<BITS, LIMBS>
der only.Source§impl<const BITS: usize, const LIMBS: usize> TryFrom<AnyRef<'_>> for Uint<BITS, LIMBS>
Available on crate feature der only.
impl<const BITS: usize, const LIMBS: usize> TryFrom<AnyRef<'_>> for Uint<BITS, LIMBS>
der only.Source§impl<const BITS: usize, const LIMBS: usize> TryFrom<BN> for Uint<BITS, LIMBS>
Available on crate feature bn-rs only.
impl<const BITS: usize, const LIMBS: usize> TryFrom<BN> for Uint<BITS, LIMBS>
bn-rs only.Source§impl<const BITS: usize, const LIMBS: usize> TryFrom<BigDecimal> for Uint<BITS, LIMBS>
Available on crate feature bigdecimal only.
impl<const BITS: usize, const LIMBS: usize> TryFrom<BigDecimal> for Uint<BITS, LIMBS>
bigdecimal only.Source§impl<const BITS: usize, const LIMBS: usize> TryFrom<BigInt> for Uint<BITS, LIMBS>
Available on crate feature num-bigint only.
impl<const BITS: usize, const LIMBS: usize> TryFrom<BigInt> for Uint<BITS, LIMBS>
num-bigint only.Source§impl<const BITS: usize, const LIMBS: usize> TryFrom<BigNumber> for Uint<BITS, LIMBS>
Available on crate feature bn-rs only.
impl<const BITS: usize, const LIMBS: usize> TryFrom<BigNumber> for Uint<BITS, LIMBS>
bn-rs only.Source§impl<const BITS: usize, const LIMBS: usize> TryFrom<BigUint> for Uint<BITS, LIMBS>
Available on crate feature num-bigint only.
impl<const BITS: usize, const LIMBS: usize> TryFrom<BigUint> for Uint<BITS, LIMBS>
num-bigint only.Source§impl<const BITS: usize, const LIMBS: usize> TryFrom<Int> for Uint<BITS, LIMBS>
Available on crate feature der only.
impl<const BITS: usize, const LIMBS: usize> TryFrom<Int> for Uint<BITS, LIMBS>
der only.Source§impl<const BITS: usize, const LIMBS: usize> TryFrom<IntRef<'_>> for Uint<BITS, LIMBS>
Available on crate feature der only.
impl<const BITS: usize, const LIMBS: usize> TryFrom<IntRef<'_>> for Uint<BITS, LIMBS>
der only.Source§impl<P: Fp256Parameters> TryFrom<Uint<256, 4>> for Fp256<P>
Available on crate feature ark-ff only.
impl<P: Fp256Parameters> TryFrom<Uint<256, 4>> for Fp256<P>
ark-ff only.Source§type Error = ToFieldError
type Error = ToFieldError
Source§impl<P: Fp320Parameters> TryFrom<Uint<320, 5>> for Fp320<P>
Available on crate feature ark-ff only.
impl<P: Fp320Parameters> TryFrom<Uint<320, 5>> for Fp320<P>
ark-ff only.Source§type Error = ToFieldError
type Error = ToFieldError
Source§impl<P: Fp384Parameters> TryFrom<Uint<384, 6>> for Fp384<P>
Available on crate feature ark-ff only.
impl<P: Fp384Parameters> TryFrom<Uint<384, 6>> for Fp384<P>
ark-ff only.Source§type Error = ToFieldError
type Error = ToFieldError
Source§impl<P: Fp448Parameters> TryFrom<Uint<448, 7>> for Fp448<P>
Available on crate feature ark-ff only.
impl<P: Fp448Parameters> TryFrom<Uint<448, 7>> for Fp448<P>
ark-ff only.Source§type Error = ToFieldError
type Error = ToFieldError
Source§impl<P: Fp64Parameters> TryFrom<Uint<64, 1>> for Fp64<P>
Available on crate feature ark-ff only.
impl<P: Fp64Parameters> TryFrom<Uint<64, 1>> for Fp64<P>
ark-ff only.Source§type Error = ToFieldError
type Error = ToFieldError
Source§impl<P: Fp768Parameters> TryFrom<Uint<768, 12>> for Fp768<P>
Available on crate feature ark-ff only.
impl<P: Fp768Parameters> TryFrom<Uint<768, 12>> for Fp768<P>
ark-ff only.Source§type Error = ToFieldError
type Error = ToFieldError
Source§impl<P: Fp832Parameters> TryFrom<Uint<832, 13>> for Fp832<P>
Available on crate feature ark-ff only.
impl<P: Fp832Parameters> TryFrom<Uint<832, 13>> for Fp832<P>
ark-ff only.Source§type Error = ToFieldError
type Error = ToFieldError
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.
impl<P: FpConfig<LIMBS>, const BITS: usize, const LIMBS: usize> TryFrom<Uint<BITS, LIMBS>> for Fp<P, LIMBS>
ark-ff-04 only.Source§type Error = ToFieldError
type Error = ToFieldError
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-05 only.
impl<P: FpConfig<LIMBS>, const BITS: usize, const LIMBS: usize> TryFrom<Uint<BITS, LIMBS>> for Fp<P, LIMBS>
ark-ff-05 only.Source§type Error = ToFieldError
type Error = ToFieldError
Source§impl<const BITS: usize, const LIMBS: usize> TryFrom<Uint> for Uint<BITS, LIMBS>
Available on crate feature der only.
impl<const BITS: usize, const LIMBS: usize> TryFrom<Uint> for Uint<BITS, LIMBS>
der only.Source§impl<const BITS: usize, const LIMBS: usize> TryFrom<UintRef<'_>> for Uint<BITS, LIMBS>
Available on crate feature der only.
impl<const BITS: usize, const LIMBS: usize> TryFrom<UintRef<'_>> for Uint<BITS, LIMBS>
der only.Source§impl<const BITS: usize, const LIMBS: usize, DB: Database> Type<DB> for Uint<BITS, LIMBS>
Available on crate feature sqlx only.
impl<const BITS: usize, const LIMBS: usize, DB: Database> Type<DB> for Uint<BITS, LIMBS>
sqlx only.Source§impl<const BITS: usize, const LIMBS: usize> Valuable for Uint<BITS, LIMBS>
Available on crate feature valuable only.
impl<const BITS: usize, const LIMBS: usize> Valuable for Uint<BITS, LIMBS>
valuable only.Source§impl<const BITS: usize, const LIMBS: usize> ValueOrd for Uint<BITS, LIMBS>
Available on crate feature der only.
impl<const BITS: usize, const LIMBS: usize> ValueOrd for Uint<BITS, LIMBS>
der only.Source§impl<const BITS: usize, const LIMBS: usize> WrappingAdd for Uint<BITS, LIMBS>
Available on crate feature num-traits only.
impl<const BITS: usize, const LIMBS: usize> WrappingAdd for Uint<BITS, LIMBS>
num-traits only.Source§fn wrapping_add(&self, v: &Self) -> Self
fn wrapping_add(&self, v: &Self) -> Self
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.
impl<const BITS: usize, const LIMBS: usize> WrappingMul for Uint<BITS, LIMBS>
num-traits only.Source§fn wrapping_mul(&self, v: &Self) -> Self
fn wrapping_mul(&self, v: &Self) -> Self
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.
impl<const BITS: usize, const LIMBS: usize> WrappingNeg for Uint<BITS, LIMBS>
num-traits only.Source§fn wrapping_neg(&self) -> Self
fn wrapping_neg(&self) -> Self
-self,
wrapping around at the boundary of the type. Read moreSource§impl<const BITS: usize, const LIMBS: usize> WrappingShl for Uint<BITS, LIMBS>
Available on crate feature num-traits only.
impl<const BITS: usize, const LIMBS: usize> WrappingShl for Uint<BITS, LIMBS>
num-traits only.Source§fn wrapping_shl(&self, rhs: u32) -> Self
fn wrapping_shl(&self, rhs: u32) -> Self
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 moreSource§impl<const BITS: usize, const LIMBS: usize> WrappingShr for Uint<BITS, LIMBS>
Available on crate feature num-traits only.
impl<const BITS: usize, const LIMBS: usize> WrappingShr for Uint<BITS, LIMBS>
num-traits only.Source§fn wrapping_shr(&self, rhs: u32) -> Self
fn wrapping_shr(&self, rhs: u32) -> Self
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 moreSource§impl<const BITS: usize, const LIMBS: usize> WrappingSub for Uint<BITS, LIMBS>
Available on crate feature num-traits only.
impl<const BITS: usize, const LIMBS: usize> WrappingSub for Uint<BITS, LIMBS>
num-traits only.Source§fn wrapping_sub(&self, v: &Self) -> Self
fn wrapping_sub(&self, v: &Self) -> Self
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.
impl<const BITS: usize, const LIMBS: usize> Zero for Uint<BITS, LIMBS>
num-traits only.Source§impl<const BITS: usize, const LIMBS: usize> Zeroable for Uint<BITS, LIMBS>
Available on crate feature bytemuck only.
impl<const BITS: usize, const LIMBS: usize> Zeroable for Uint<BITS, LIMBS>
bytemuck only.Source§impl<const BITS: usize, const LIMBS: usize> Zeroize for Uint<BITS, LIMBS>
Available on crate feature zeroize only.
impl<const BITS: usize, const LIMBS: usize> Zeroize for Uint<BITS, LIMBS>
zeroize only.impl<const BITS: usize, const LIMBS: usize> Copy for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> Eq for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> MaxEncodedLen<{ Self::BYTES + length_of_length(Self::BYTES) }> for Uint<BITS, LIMBS>
alloy-rlp only.impl Pod for Uint<{ 1024 }, 16>
bytemuck only.impl Pod for Uint<{ 128 }, 2>
bytemuck only.impl Pod for Uint<{ 192 }, 3>
bytemuck only.impl Pod for Uint<{ 256 }, 4>
bytemuck only.impl Pod for Uint<{ 320 }, 5>
bytemuck only.impl Pod for Uint<{ 384 }, 6>
bytemuck only.impl Pod for Uint<{ 448 }, 7>
bytemuck only.impl Pod for Uint<{ 512 }, 8>
bytemuck only.impl Pod for Uint<{ 576 }, 9>
bytemuck only.impl Pod for Uint<{ 64 }, 1>
bytemuck only.impl Pod for Uint<{ 640 }, 10>
bytemuck only.impl Pod for Uint<{ 704 }, 11>
bytemuck only.impl Pod for Uint<{ 768 }, 12>
bytemuck only.impl Pod for Uint<{ 832 }, 13>
bytemuck only.impl Pod for Uint<{ 896 }, 14>
bytemuck only.impl Pod for Uint<{ 960 }, 15>
bytemuck only.impl<const BITS: usize, const LIMBS: usize> StructuralPartialEq for Uint<BITS, LIMBS>
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>.
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>
impl<const BITS: usize, const LIMBS: usize, T> UintTryTo<T> for Uint<BITS, LIMBS>where
T: for<'a> TryFrom<&'a Self, Error = FromUintError<T>>,
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>
impl<const BITS: usize, const LIMBS: usize> Unsigned for Uint<BITS, LIMBS>
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> UnsafeUnpin for Uint<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> UnwindSafe for Uint<BITS, LIMBS>
Blanket Implementations§
Source§impl<T> AggregateExpressionMethods for T
impl<T> AggregateExpressionMethods for T
Source§fn aggregate_distinct(self) -> Self::Outputwhere
Self: DistinctDsl,
fn aggregate_distinct(self) -> Self::Outputwhere
Self: DistinctDsl,
DISTINCT modifier for aggregate functions Read moreSource§fn aggregate_all(self) -> Self::Outputwhere
Self: AllDsl,
fn aggregate_all(self) -> Self::Outputwhere
Self: AllDsl,
ALL modifier for aggregate functions Read moreSource§fn aggregate_filter<P>(self, f: P) -> Self::Output
fn aggregate_filter<P>(self, f: P) -> Self::Output
Source§fn aggregate_order<O>(self, o: O) -> Self::Outputwhere
Self: OrderAggregateDsl<O>,
fn aggregate_order<O>(self, o: O) -> Self::Outputwhere
Self: OrderAggregateDsl<O>,
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<T> ArchiveUnsized for Twhere
T: Archive,
impl<T> ArchiveUnsized for Twhere
T: Archive,
Source§type Archived = <T as Archive>::Archived
type Archived = <T as Archive>::Archived
Archive, it may be
unsized. Read moreSource§fn archived_metadata(
&self,
) -> <<T as ArchiveUnsized>::Archived as ArchivePointee>::ArchivedMetadata
fn archived_metadata( &self, ) -> <<T as ArchiveUnsized>::Archived as ArchivePointee>::ArchivedMetadata
Source§impl<I> Average for I
impl<I> Average for I
Source§fn average_floor(&self, other: &I) -> I
fn average_floor(&self, other: &I) -> I
Returns the floor value of the average of self and other.
Source§fn average_ceil(&self, other: &I) -> I
fn average_ceil(&self, other: &I) -> I
Returns the ceil value of the average of self and other.
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> BorrowToSql for Twhere
T: ToSql,
impl<T> BorrowToSql for Twhere
T: ToSql,
Source§fn borrow_to_sql(&self) -> &dyn ToSql
fn borrow_to_sql(&self) -> &dyn ToSql
self as a ToSql trait object.Source§impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
Source§type Bits = T
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
fn is_valid_bit_pattern(_bits: &T) -> bool
bits
as &Self.Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<T> ConditionallyNegatable for T
impl<T> ConditionallyNegatable for T
Source§fn conditional_negate(&mut self, choice: Choice)
fn conditional_negate(&mut self, choice: Choice)
Source§impl<'a, T> Decode<'a> for Twhere
T: DecodeValue<'a> + FixedTag,
impl<'a, T> Decode<'a> for Twhere
T: DecodeValue<'a> + FixedTag,
Source§impl<T> DecodeLimit for Twhere
T: Decode,
impl<T> DecodeLimit for Twhere
T: Decode,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Encode for Twhere
T: EncodeValue + Tagged,
impl<T> Encode for Twhere
T: EncodeValue + Tagged,
Source§fn encoded_len(&self) -> Result<Length, Error>
fn encoded_len(&self) -> Result<Length, Error>
Compute the length of this value in bytes when encoded as ASN.1 DER.
Source§fn encode(&self, writer: &mut impl Writer) -> Result<(), Error>
fn encode(&self, writer: &mut impl Writer) -> Result<(), Error>
Encode this value as ASN.1 DER using the provided Writer.
Source§fn encode_to_slice<'a>(&self, buf: &'a mut [u8]) -> Result<&'a [u8], Error>
fn encode_to_slice<'a>(&self, buf: &'a mut [u8]) -> Result<&'a [u8], Error>
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<'py, T> FromPyObjectBound<'_, 'py> for Twhere
T: FromPyObject<'py>,
impl<'py, T> FromPyObjectBound<'_, 'py> for Twhere
T: FromPyObject<'py>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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 moreSource§impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
Source§fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
self into an owned Python object, dropping type information.Source§impl<T> IntoSql for T
impl<T> IntoSql for T
Source§fn into_sql<T>(self) -> Self::Expression
fn into_sql<T>(self) -> Self::Expression
self to an expression for Diesel’s query builder. Read moreSource§fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
&self to an expression for Diesel’s query builder. Read moreSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T> LowerBounded for Twhere
T: Bounded,
impl<T> LowerBounded for Twhere
T: Bounded,
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.