pub struct BoxedUint { /* private fields */ }
Available on crate feature alloc only.
Expand description

Fixed-precision heap-allocated big unsigned integer.

Alternative to the stack-allocated Uint but with a fixed precision chosen at runtime instead of compile time.

Unlike many other heap-allocated big integer libraries, this type is not arbitrary precision and will wrap at its fixed-precision rather than automatically growing.

Implementations§

source§

impl BoxedUint

source

pub fn adc(&self, rhs: &Self, carry: Limb) -> (Self, Limb)

Computes a + b + carry, returning the result along with the new carry.

source

pub fn adc_assign(&mut self, rhs: &Self, carry: Limb) -> Limb

Computes a + b + carry in-place, returning the new carry.

Panics if rhs has a larger precision than self.

source

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

Perform wrapping addition, discarding overflow.

source§

impl BoxedUint

source

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

Computes self + rhs mod p.

Assumes self + rhs as unbounded integer is < 2p.

source§

impl BoxedUint

source

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

Computes bitwise a & b.

source

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

Perform bitwise AND between self and the given Limb, performing the AND operation on every limb of self.

source

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

Perform wrapping bitwise AND.

There’s no way wrapping could ever happen. This function exists so that all operations are accounted for in the wrapping operations

source

pub fn checked_and(&self, rhs: &Self) -> CtOption<Self>

Perform checked bitwise AND, returning a CtOption which is_some always

source§

impl BoxedUint

source

pub fn not(&self) -> Self

Computes bitwise !a.

source§

impl BoxedUint

source

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

Computes bitwise a & b.

source

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

Perform wrapping bitwise OR.

There’s no way wrapping could ever happen. This function exists so that all operations are accounted for in the wrapping operations

source

pub fn checked_or(&self, rhs: &Self) -> CtOption<Self>

Perform checked bitwise OR, returning a CtOption which is_some always

source§

impl BoxedUint

source

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

Computes bitwise a ^ b.

source

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

Perform wrapping bitwise `XOR``.

There’s no way wrapping could ever happen. This function exists so that all operations are accounted for in the wrapping operations

source

pub fn checked_xor(&self, rhs: &Self) -> CtOption<Self>

Perform checked bitwise XOR, returning a CtOption which is_some always

source§

impl BoxedUint

source

pub fn bit(&self, index: u32) -> Choice

Get the value of the bit at position index, as a truthy or falsy Choice. Returns the falsy value for indices out of range.

source

pub const fn bit_vartime(&self, index: u32) -> bool

Returns true if the bit at position index is set, false otherwise.

Remarks

This operation is variable time with respect to index only.

source

pub fn bits(&self) -> u32

Calculate the number of bits needed to represent this number, i.e. the index of the highest set bit.

Use BoxedUint::bits_precision to get the total capacity of this integer.

source

pub fn bits_vartime(&self) -> u32

Calculate the number of bits needed to represent this number in variable-time with respect to self.

source

pub const fn leading_zeros(&self) -> u32

Calculate the number of leading zeros in the binary representation of this number.

source

pub fn bits_precision(&self) -> u32

Get the precision of this BoxedUint in bits.

source

pub fn trailing_zeros(&self) -> u32

Calculate the number of trailing zeros in the binary representation of this number.

source

pub fn trailing_ones(&self) -> u32

Calculate the number of trailing ones in the binary representation of this number.

source

pub fn trailing_zeros_vartime(&self) -> u32

Calculate the number of trailing zeros in the binary representation of this number in variable-time with respect to self.

source

pub fn trailing_ones_vartime(&self) -> u32

Calculate the number of trailing ones in the binary representation of this number, variable time in self.

source§

impl BoxedUint

source

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

Returns the Ordering between self and rhs in variable time.

source§

impl BoxedUint

source

pub fn div_rem_limb_with_reciprocal( &self, reciprocal: &Reciprocal ) -> (Self, Limb)

Computes self / rhs using a pre-made reciprocal, returns the quotient (q) and remainder (r).

source

pub fn div_rem_limb(&self, rhs: NonZero<Limb>) -> (Self, Limb)

Computes self / rhs, returns the quotient (q) and remainder (r).

source

pub fn rem_limb_with_reciprocal(&self, reciprocal: &Reciprocal) -> Limb

Computes self % rhs using a pre-made reciprocal.

source

pub fn rem_limb(&self, rhs: NonZero<Limb>) -> Limb

Computes self % rhs.

source

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

Computes self / rhs, returns the quotient, remainder.

source

pub fn rem(&self, rhs: &NonZero<Self>) -> Self

Computes self % rhs, returns the remainder.

source

pub fn div_rem_vartime(&self, rhs: &NonZero<Self>) -> (Self, Self)

Computes self / rhs, returns the quotient, remainder.

Variable-time with respect to rhs

source

pub fn rem_vartime(&self, rhs: &NonZero<Self>) -> Self

Computes self % rhs, returns the remainder.

Variable-time with respect to rhs.

Panics

Panics if self and rhs have different precisions.

source

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

Wrapped division is just normal division i.e. self / rhs There’s no way wrapping could ever happen.

This function exists, so that all operations are accounted for in the wrapping operations.

Panics if rhs == 0.

source

pub fn wrapping_div_vartime(&self, rhs: &NonZero<Self>) -> Self

Wrapped division is just normal division i.e. self / rhs

There’s no way wrapping could ever happen. This function exists, so that all operations are accounted for in the wrapping operations

source

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

Perform checked division, returning a CtOption which is_some only if the rhs != 0

source§

impl BoxedUint

source

pub fn from_be_slice( bytes: &[u8], bits_precision: u32 ) -> Result<Self, DecodeError>

Create a new BoxedUint from the provided big endian bytes.

The bits_precision argument represents the precision of the resulting integer, which is fixed as this type is not arbitrary-precision. The new BoxedUint will be created with bits_precision rounded up to a multiple of Limb::BITS.

If the length of bytes is larger than bits_precision (rounded up to a multiple of 8) this function will return DecodeError::InputSize. If the size of the decoded integer is larger than bits_precision, this function will return DecodeError::Precision.

source

pub fn from_le_slice( bytes: &[u8], bits_precision: u32 ) -> Result<Self, DecodeError>

Create a new BoxedUint from the provided little endian bytes.

The bits_precision argument represents the precision of the resulting integer, which is fixed as this type is not arbitrary-precision. The new BoxedUint will be created with bits_precision rounded up to a multiple of Limb::BITS.

If the length of bytes is larger than bits_precision (rounded up to a multiple of 8) this function will return DecodeError::InputSize. If the size of the decoded integer is larger than bits_precision, this function will return DecodeError::Precision.

source

pub fn to_be_bytes(&self) -> Box<[u8]>

Serialize this BoxedUint as big-endian.

source

pub fn to_le_bytes(&self) -> Box<[u8]>

Serialize this BoxedUint as little-endian.

source

pub fn from_be_hex(hex: &str, bits_precision: u32) -> CtOption<Self>

Create a new BoxedUint from the provided big endian hex string.

source§

impl BoxedUint

source

pub fn inv_odd_mod(&self, modulus: &Odd<Self>) -> CtOption<Self>

Computes the multiplicative inverse of self mod modulus, where modulus is odd.

source§

impl BoxedUint

source

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

Multiply self by rhs.

Returns a widened output with a limb count equal to the sums of the input limb counts.

source

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

Perform wrapping multiplication, wrapping to the width of self.

source

pub fn square(&self) -> Self

Multiply self by itself.

source§

impl BoxedUint

source

pub fn mul_mod(&self, rhs: &BoxedUint, p: &BoxedUint) -> BoxedUint

Computes self * rhs mod p for odd p.

Panics if p is even.

source

pub fn mul_mod_special(&self, rhs: &Self, c: Limb) -> Self

Computes self * rhs mod p for the special modulus p = MAX+1-c where c is small enough to fit in a single Limb.

For the modulus reduction, this function implements Algorithm 14.47 from the “Handbook of Applied Cryptography”, by A. Menezes, P. van Oorschot, and S. Vanstone, CRC Press, 1996.

source§

impl BoxedUint

source

pub fn wrapping_neg(&self) -> Self

Perform wrapping negation.

source§

impl BoxedUint

source

pub fn neg_mod(&self, p: &Self) -> Self

Computes -a mod p. Assumes self is in [0, p).

source

pub fn neg_mod_special(&self, c: Limb) -> Self

Computes -a mod p for the special modulus p = MAX+1-c where c is small enough to fit in a single Limb.

source§

impl BoxedUint

source

pub fn shl(&self, shift: u32) -> BoxedUint

Computes self << shift.

Panics if shift >= Self::BITS.

source

pub fn shl_assign(&mut self, shift: u32)

Computes self <<= shift.

Panics if shift >= Self::BITS.

source

pub fn overflowing_shl(&self, shift: u32) -> (Self, Choice)

Computes self << shift.

Returns a zero and a truthy Choice if shift >= self.bits_precision(), or the result and a falsy Choice otherwise.

source

pub fn overflowing_shl_assign(&mut self, shift: u32) -> Choice

Computes self <<= shift.

Returns a truthy Choice if shift >= self.bits_precision() or a falsy Choice otherwise.

source

pub fn wrapping_shl(&self, shift: u32) -> Self

Computes self << shift in a panic-free manner, masking off bits of shift which would cause the shift to exceed the type’s width.

source

pub fn wrapping_shl_vartime(&self, shift: u32) -> Self

Computes self << shift in variable-time in a panic-free manner, masking off bits of shift which would cause the shift to exceed the type’s width.

source

pub fn shl_vartime(&self, shift: u32) -> Option<Self>

Computes self << shift. Returns None if shift >= self.bits_precision().

NOTE: this operation is variable time with respect to shift ONLY.

When used with a fixed shift, this function is constant-time with respect to self.

source§

impl BoxedUint

source

pub fn shr(&self, shift: u32) -> BoxedUint

Computes self >> shift.

Panics if shift >= Self::BITS.

source

pub fn shr_assign(&mut self, shift: u32)

Computes self >>= shift.

Panics if shift >= Self::BITS.

source

pub fn overflowing_shr(&self, shift: u32) -> (Self, Choice)

Computes self >> shift.

Returns a zero and a truthy Choice if shift >= self.bits_precision(), or the result and a falsy Choice otherwise.

source

pub fn overflowing_shr_assign(&mut self, shift: u32) -> Choice

Computes self >>= shift.

Returns a truthy Choice if shift >= self.bits_precision() or a falsy Choice otherwise.

source

pub fn wrapping_shr(&self, shift: u32) -> Self

Computes self >> shift in a panic-free manner, masking off bits of shift which would cause the shift to exceed the type’s width.

source

pub fn wrapping_shr_vartime(&self, shift: u32) -> Self

Computes self >> shift in variable-time in a panic-free manner, masking off bits of shift which would cause the shift to exceed the type’s width.

source

pub fn shr_vartime(&self, shift: u32) -> Option<Self>

Computes self >> shift. Returns None if shift >= self.bits_precision().

NOTE: this operation is variable time with respect to shift ONLY.

When used with a fixed shift, this function is constant-time with respect to self.

source§

impl BoxedUint

source

pub fn sqrt(&self) -> Self

Computes √(self) in constant time.

Callers can check if self is a square by squaring the result

source

pub fn sqrt_vartime(&self) -> Self

Computes √(self)

Callers can check if self is a square by squaring the result

source

pub fn wrapping_sqrt(&self) -> Self

Wrapped sqrt is just normal √(self) There’s no way wrapping could ever happen. This function exists so that all operations are accounted for in the wrapping operations.

source

pub fn wrapping_sqrt_vartime(&self) -> Self

Wrapped sqrt is just normal √(self) There’s no way wrapping could ever happen. This function exists so that all operations are accounted for in the wrapping operations.

source

pub fn checked_sqrt(&self) -> CtOption<Self>

Perform checked sqrt, returning a CtOption which is_some only if the √(self)² == self

source

pub fn checked_sqrt_vartime(&self) -> CtOption<Self>

Perform checked sqrt, returning a CtOption which is_some only if the √(self)² == self

source§

impl BoxedUint

source

pub fn sbb(&self, rhs: &Self, borrow: Limb) -> (Self, Limb)

Computes a - (b + borrow), returning the result along with the new borrow.

source

pub fn sbb_assign(&mut self, rhs: &Self, borrow: Limb) -> Limb

Computes a - (b + borrow) in-place, returning the new borrow.

Panics if rhs has a larger precision than self.

source

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

Perform wrapping subtraction, discarding overflow.

source§

impl BoxedUint

source

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

Computes self - rhs mod p.

Assumes self - rhs as unbounded signed integer is in [-p, p).

source

pub fn sub_mod_special(&self, rhs: &Self, c: Limb) -> Self

Computes self - rhs mod p for the special modulus p = MAX+1-c where c is small enough to fit in a single Limb.

Assumes self - rhs as unbounded signed integer is in [-p, p).

source§

impl BoxedUint

source

pub fn zero() -> Self

Get the value 0 represented as succinctly as possible.

source

pub fn zero_with_precision(at_least_bits_precision: u32) -> Self

Get the value 0 with the given number of bits of precision.

at_least_bits_precision is rounded up to a multiple of Limb::BITS.

source

pub fn one() -> Self

Get the value 1, represented as succinctly as possible.

source

pub fn one_with_precision(at_least_bits_precision: u32) -> Self

Get the value 1 with the given number of bits of precision.

at_least_bits_precision is rounded up to a multiple of Limb::BITS.

source

pub fn is_zero(&self) -> Choice

Is this BoxedUint equal to zero?

source

pub fn is_nonzero(&self) -> Choice

Is this BoxedUint not equal to zero?

source

pub fn is_one(&self) -> Choice

Is this BoxedUint equal to one?

source

pub fn max(at_least_bits_precision: u32) -> Self

Get the maximum value for a BoxedUint created with at_least_bits_precision precision bits requested.

That is, returns the value 2^self.bits_precision() - 1.

source

pub fn from_words(words: impl IntoIterator<Item = Word>) -> Self

Create a BoxedUint from an array of Words (i.e. word-sized unsigned integers).

source

pub fn to_words(&self) -> Box<[Word]>

Create a boxed slice of Words (i.e. word-sized unsigned integers) from a BoxedUint.

source

pub fn as_words(&self) -> &[Word]

Borrow the inner limbs as a slice of Words.

source

pub fn as_words_mut(&mut self) -> &mut [Word]

Borrow the inner limbs as a mutable slice of Words.

source

pub fn as_limbs(&self) -> &[Limb]

Borrow the limbs of this BoxedUint.

source

pub fn as_limbs_mut(&mut self) -> &mut [Limb]

Borrow the limbs of this BoxedUint mutably.

source

pub fn to_limbs(&self) -> Box<[Limb]>

Convert this BoxedUint into its inner limbs.

source

pub fn into_limbs(self) -> Box<[Limb]>

Convert this BoxedUint into its inner limbs.

source

pub fn nlimbs(&self) -> usize

Get the number of limbs in this BoxedUint.

source

pub fn to_odd(&self) -> CtOption<Odd<Self>>

Convert into an Odd.

source

pub fn widen(&self, at_least_bits_precision: u32) -> BoxedUint

Widen this type’s precision to the given number of bits.

Panics if at_least_bits_precision is smaller than the current precision.

source

pub fn shorten(&self, at_least_bits_precision: u32) -> BoxedUint

Shortens this type’s precision to the given number of bits.

Panics if at_least_bits_precision is larger than the current precision.

Trait Implementations§

source§

impl Add<&BoxedUint> for &BoxedUint

§

type Output = BoxedUint

The resulting type after applying the + operator.
source§

fn add(self, rhs: &BoxedUint) -> BoxedUint

Performs the + operation. Read more
source§

impl Add<&BoxedUint> for BoxedUint

§

type Output = BoxedUint

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl Add for BoxedUint

§

type Output = BoxedUint

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl AddMod for BoxedUint

§

type Output = BoxedUint

Output type.
source§

fn add_mod(&self, rhs: &Self, p: &Self) -> Self

Compute self + rhs mod p. Read more
source§

impl AsMut<[Limb]> for BoxedUint

source§

fn as_mut(&mut self) -> &mut [Limb]

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl AsMut<[u64]> for BoxedUint

source§

fn as_mut(&mut self) -> &mut [Word]

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl AsRef<[Limb]> for BoxedUint

source§

fn as_ref(&self) -> &[Limb]

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<[u64]> for BoxedUint

source§

fn as_ref(&self) -> &[Word]

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl BitAnd<&BoxedUint> for &BoxedUint

§

type Output = BoxedUint

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: &BoxedUint) -> BoxedUint

Performs the & operation. Read more
source§

impl BitAnd<&BoxedUint> for BoxedUint

§

type Output = BoxedUint

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: &BoxedUint) -> BoxedUint

Performs the & operation. Read more
source§

impl BitAnd<BoxedUint> for &BoxedUint

§

type Output = BoxedUint

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: BoxedUint) -> BoxedUint

Performs the & operation. Read more
source§

impl BitAnd for BoxedUint

§

type Output = BoxedUint

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: Self) -> BoxedUint

Performs the & operation. Read more
source§

impl BitAndAssign<&BoxedUint> for BoxedUint

source§

fn bitand_assign(&mut self, other: &Self)

Performs the &= operation. Read more
source§

impl BitAndAssign for BoxedUint

source§

fn bitand_assign(&mut self, other: Self)

Performs the &= operation. Read more
source§

impl BitOps for BoxedUint

source§

fn bits_precision(&self) -> u32

Precision of this integer in bits.
source§

fn bytes_precision(&self) -> usize

Precision of this integer in bytes.
source§

fn leading_zeros(&self) -> u32

Calculate the number of leading zeros in the binary representation of this number.
source§

fn bits(&self) -> u32

Calculate the number of bits required to represent a given number.
source§

fn bit(&self, index: u32) -> Choice

Calculate the number of bits needed to represent this number.
source§

fn set_bit(&mut self, index: u32, bit_value: Choice)

Sets the bit at index to 0 or 1 depending on the value of bit_value.
source§

fn trailing_zeros(&self) -> u32

Calculate the number of trailing zeros in the binary representation of this number.
source§

fn trailing_ones(&self) -> u32

Calculate the number of trailing ones in the binary representation of this number.
source§

fn bit_vartime(&self, index: u32) -> bool

Returns true if the bit at position index is set, false otherwise. Read more
source§

fn bits_vartime(&self) -> u32

Calculate the number of bits required to represent a given number in variable-time with respect to self.
source§

fn set_bit_vartime(&mut self, index: u32, bit_value: bool)

Sets the bit at index to 0 or 1 depending on the value of bit_value, variable time in self.
source§

fn trailing_zeros_vartime(&self) -> u32

Calculate the number of trailing zeros in the binary representation of this number in variable-time with respect to self.
source§

fn trailing_ones_vartime(&self) -> u32

Calculate the number of trailing ones in the binary representation of this number, variable time in self.
source§

fn log2_bits(&self) -> u32

floor(log2(self.bits_precision())).
source§

fn leading_zeros_vartime(&self) -> u32

Calculate the number of leading zeros in the binary representation of this number.
source§

impl BitOr<&BoxedUint> for &BoxedUint

§

type Output = BoxedUint

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: &BoxedUint) -> BoxedUint

Performs the | operation. Read more
source§

impl BitOr<&BoxedUint> for BoxedUint

§

type Output = BoxedUint

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: &BoxedUint) -> BoxedUint

Performs the | operation. Read more
source§

impl BitOr<BoxedUint> for &BoxedUint

§

type Output = BoxedUint

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: BoxedUint) -> BoxedUint

Performs the | operation. Read more
source§

impl BitOr for BoxedUint

§

type Output = BoxedUint

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: Self) -> BoxedUint

Performs the | operation. Read more
source§

impl BitOrAssign<&BoxedUint> for BoxedUint

source§

fn bitor_assign(&mut self, other: &Self)

Performs the |= operation. Read more
source§

impl BitOrAssign for BoxedUint

source§

fn bitor_assign(&mut self, other: Self)

Performs the |= operation. Read more
source§

impl BitXor<&BoxedUint> for &BoxedUint

§

type Output = BoxedUint

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: &BoxedUint) -> BoxedUint

Performs the ^ operation. Read more
source§

impl BitXor<&BoxedUint> for BoxedUint

§

type Output = BoxedUint

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: &BoxedUint) -> BoxedUint

Performs the ^ operation. Read more
source§

impl BitXor<BoxedUint> for &BoxedUint

§

type Output = BoxedUint

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: BoxedUint) -> BoxedUint

Performs the ^ operation. Read more
source§

impl BitXor for BoxedUint

§

type Output = BoxedUint

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: Self) -> BoxedUint

Performs the ^ operation. Read more
source§

impl BitXorAssign<&BoxedUint> for BoxedUint

source§

fn bitxor_assign(&mut self, other: &Self)

Performs the ^= operation. Read more
source§

impl BitXorAssign for BoxedUint

source§

fn bitxor_assign(&mut self, other: Self)

Performs the ^= operation. Read more
source§

impl CheckedAdd for BoxedUint

source§

fn checked_add(&self, rhs: &Self) -> CtOption<Self>

Perform checked addition, returning a CtOption which is_some only if the operation did not overflow.
source§

impl CheckedDiv for BoxedUint

source§

fn checked_div(&self, rhs: &BoxedUint) -> CtOption<Self>

Perform checked division, returning a CtOption which is_some only if the divisor is non-zero.
source§

impl CheckedMul for BoxedUint

source§

fn checked_mul(&self, rhs: &BoxedUint) -> CtOption<Self>

Perform checked multiplication, returning a CtOption which is_some only if the operation did not overflow.
source§

impl CheckedSub for BoxedUint

source§

fn checked_sub(&self, rhs: &Self) -> CtOption<Self>

Perform checked subtraction, returning a CtOption which is_some only if the operation did not underflow.
source§

impl Clone for BoxedUint

source§

fn clone(&self) -> BoxedUint

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

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

Performs copy-assignment from source. Read more
source§

impl ConstantTimeEq for BoxedUint

source§

fn ct_eq(&self, other: &Self) -> Choice

Determine if two items are equal. Read more
source§

fn ct_ne(&self, other: &Self) -> Choice

Determine if two items are NOT equal. Read more
source§

impl ConstantTimeGreater for BoxedUint

source§

fn ct_gt(&self, other: &Self) -> Choice

Determine whether self > other. Read more
source§

impl ConstantTimeLess for BoxedUint

source§

fn ct_lt(&self, other: &Self) -> Choice

Determine whether self < other. Read more
source§

impl ConstantTimeSelect for BoxedUint

NOTE: can’t impl subtle’s ConditionallySelectable trait due to its Copy bound

source§

fn ct_select(a: &Self, b: &Self, choice: Choice) -> Self

Select a or b according to choice. Read more
source§

fn ct_assign(&mut self, other: &Self, choice: Choice)

Conditionally assign other to self, according to choice.
source§

fn ct_swap(a: &mut Self, b: &mut Self, choice: Choice)

Conditionally swap self and other if choice == 1; otherwise, reassign both unto themselves.
source§

impl Debug for BoxedUint

source§

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

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

impl Default for BoxedUint

source§

fn default() -> Self

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

impl Display for BoxedUint

source§

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

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

impl Div<&NonZero<BoxedUint>> for &BoxedUint

§

type Output = BoxedUint

The resulting type after applying the / operator.
source§

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

Performs the / operation. Read more
source§

impl Div<&NonZero<BoxedUint>> for BoxedUint

§

type Output = BoxedUint

The resulting type after applying the / operator.
source§

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

Performs the / operation. Read more
source§

impl Div<NonZero<BoxedUint>> for &BoxedUint

§

type Output = BoxedUint

The resulting type after applying the / operator.
source§

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

Performs the / operation. Read more
source§

impl Div<NonZero<BoxedUint>> for BoxedUint

§

type Output = BoxedUint

The resulting type after applying the / operator.
source§

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

Performs the / operation. Read more
source§

impl DivAssign<&NonZero<BoxedUint>> for BoxedUint

source§

fn div_assign(&mut self, rhs: &NonZero<BoxedUint>)

Performs the /= operation. Read more
source§

impl DivAssign<NonZero<BoxedUint>> for BoxedUint

source§

fn div_assign(&mut self, rhs: NonZero<BoxedUint>)

Performs the /= operation. Read more
source§

impl DivRemLimb for BoxedUint

source§

fn div_rem_limb_with_reciprocal(&self, reciprocal: &Reciprocal) -> (Self, Limb)

Computes self / rhs, returns the quotient (q) and remainder (r).
source§

fn div_rem_limb(&self, rhs: NonZero<Limb>) -> (Self, Limb)

Computes self / rhs using a pre-made reciprocal, returns the quotient (q) and remainder (r).
source§

impl From<&[Limb]> for BoxedUint

source§

fn from(limbs: &[Limb]) -> BoxedUint

Converts to this type from the input type.
source§

impl<const LIMBS: usize> From<&Odd<Uint<LIMBS>>> for BoxedUint

source§

fn from(uint: &Odd<Uint<LIMBS>>) -> BoxedUint

Converts to this type from the input type.
source§

impl<const LIMBS: usize> From<&Uint<LIMBS>> for BoxedUint

source§

fn from(uint: &Uint<LIMBS>) -> BoxedUint

Converts to this type from the input type.
source§

impl From<Box<[Limb]>> for BoxedUint

source§

fn from(limbs: Box<[Limb]>) -> BoxedUint

Converts to this type from the input type.
source§

impl From<Limb> for BoxedUint

source§

fn from(limb: Limb) -> Self

Converts to this type from the input type.
source§

impl<const LIMBS: usize> From<Odd<Uint<LIMBS>>> for BoxedUint

source§

fn from(uint: Odd<Uint<LIMBS>>) -> BoxedUint

Converts to this type from the input type.
source§

impl<const LIMBS: usize> From<Uint<LIMBS>> for BoxedUint

source§

fn from(uint: Uint<LIMBS>) -> BoxedUint

Converts to this type from the input type.
source§

impl From<Vec<Limb>> for BoxedUint

source§

fn from(limbs: Vec<Limb>) -> BoxedUint

Converts to this type from the input type.
source§

impl From<Vec<u64>> for BoxedUint

source§

fn from(words: Vec<Word>) -> BoxedUint

Converts to this type from the input type.
source§

impl From<u128> for BoxedUint

source§

fn from(n: u128) -> Self

Converts to this type from the input type.
source§

impl From<u16> for BoxedUint

source§

fn from(n: u16) -> Self

Converts to this type from the input type.
source§

impl From<u32> for BoxedUint

source§

fn from(n: u32) -> Self

Converts to this type from the input type.
source§

impl From<u64> for BoxedUint

source§

fn from(n: u64) -> Self

Converts to this type from the input type.
source§

impl From<u8> for BoxedUint

source§

fn from(n: u8) -> Self

Converts to this type from the input type.
source§

impl Gcd<BoxedUint> for Odd<BoxedUint>

§

type Output = BoxedUint

Output type.
source§

fn gcd(&self, rhs: &BoxedUint) -> BoxedUint

Compute greatest common divisor of self and rhs. Read more
source§

impl Gcd for BoxedUint

§

type Output = CtOption<BoxedUint>

Output type.
source§

fn gcd(&self, rhs: &Self) -> CtOption<Self>

Compute greatest common divisor of self and rhs. Read more
source§

impl Hash for BoxedUint

source§

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

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

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

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

impl Integer for BoxedUint

§

type Monty = BoxedMontyForm

The corresponding Montgomery representation, optimized for the performance of modular operations at the price of a conversion overhead.
source§

fn one() -> Self

The value 1.
source§

fn from_limb_like(limb: Limb, other: &Self) -> Self

Returns an integer with the first limb set to limb, and the same precision as other.
source§

fn nlimbs(&self) -> usize

Number of limbs in this integer.
source§

fn one_like(other: &Self) -> Self

The value 1 with the same precision as other.
source§

fn is_odd(&self) -> Choice

Is this integer value an odd number? Read more
source§

fn is_even(&self) -> Choice

Is this integer value an even number? Read more
source§

impl InvMod for BoxedUint

source§

fn inv_mod(&self, modulus: &Self) -> CtOption<Self>

Note: currently only supports odd modulus

source§

impl LowerHex for BoxedUint

source§

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

Formats the value using the given formatter.
source§

impl Mul<&BoxedUint> for &BoxedUint

§

type Output = BoxedUint

The resulting type after applying the * operator.
source§

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

Performs the * operation. Read more
source§

impl Mul<&BoxedUint> for BoxedUint

§

type Output = BoxedUint

The resulting type after applying the * operator.
source§

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

Performs the * operation. Read more
source§

impl Mul<BoxedUint> for &BoxedUint

§

type Output = BoxedUint

The resulting type after applying the * operator.
source§

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

Performs the * operation. Read more
source§

impl Mul for BoxedUint

§

type Output = BoxedUint

The resulting type after applying the * operator.
source§

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

Performs the * operation. Read more
source§

impl MulMod for BoxedUint

§

type Output = BoxedUint

Output type.
source§

fn mul_mod(&self, rhs: &Self, p: &Self) -> Self

Compute self * rhs mod p.
source§

impl NegMod for BoxedUint

§

type Output = BoxedUint

Output type.
source§

fn neg_mod(&self, p: &Self) -> Self

Compute -self mod p.
source§

impl Not for BoxedUint

§

type Output = BoxedUint

The resulting type after applying the ! operator.
source§

fn not(self) -> Self

Performs the unary ! operation. Read more
source§

impl One for BoxedUint

source§

fn one() -> Self

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

fn is_one(&self) -> bool

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

fn set_one(&mut self)

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

impl Ord for BoxedUint

source§

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

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

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

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

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

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

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

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

impl PartialEq<Odd<BoxedUint>> for BoxedUint

source§

fn eq(&self, other: &Odd<BoxedUint>) -> bool

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

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

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

impl PartialEq for BoxedUint

source§

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

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

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

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

impl PartialOrd<Odd<BoxedUint>> for BoxedUint

source§

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

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

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

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

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

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

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

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

impl PartialOrd for BoxedUint

source§

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

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

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

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

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

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

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

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

impl PowBoundedExp<BoxedUint> for BoxedMontyForm

source§

fn pow_bounded_exp(&self, exponent: &BoxedUint, exponent_bits: u32) -> Self

Raises to the exponent power, with exponent_bits representing the number of (least significant) bits to take into account for the exponent. Read more
source§

impl RandomBits for BoxedUint

Available on crate feature rand_core only.
source§

fn try_random_bits( rng: &mut impl CryptoRngCore, bit_length: u32 ) -> Result<Self, RandomBitsError>

Generate a cryptographically secure random value in range [0, 2^bit_length). Read more
source§

fn try_random_bits_with_precision( rng: &mut impl CryptoRngCore, bit_length: u32, bits_precision: u32 ) -> Result<Self, RandomBitsError>

Generate a cryptographically secure random value in range [0, 2^bit_length), returning an integer with the closest available size to bits_precision (if the implementing type supports runtime sizing). Read more
source§

fn random_bits(rng: &mut impl CryptoRngCore, bit_length: u32) -> Self

Generate a cryptographically secure random value in range [0, 2^bit_length). Read more
source§

fn random_bits_with_precision( rng: &mut impl CryptoRngCore, bit_length: u32, bits_precision: u32 ) -> Self

Generate a cryptographically secure random value in range [0, 2^bit_length), returning an integer with the closest available size to bits_precision (if the implementing type supports runtime sizing). Read more
source§

impl RandomMod for BoxedUint

Available on crate feature rand_core only.
source§

fn random_mod(rng: &mut impl CryptoRngCore, modulus: &NonZero<Self>) -> Self

Generate a cryptographically secure random BoxedUint which is less than a given modulus.

This function uses rejection sampling, a method which produces an unbiased distribution of in-range values provided the underlying CSRNG is unbiased, but runs in variable-time.

The variable-time nature of the algorithm should not pose a security issue so long as the underlying random number generator is truly a CSRNG, where previous outputs are unrelated to subsequent outputs and do not reveal information about the RNG’s internal state.

source§

impl Rem<&NonZero<BoxedUint>> for &BoxedUint

§

type Output = BoxedUint

The resulting type after applying the % operator.
source§

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

Performs the % operation. Read more
source§

impl Rem<&NonZero<BoxedUint>> for BoxedUint

§

type Output = BoxedUint

The resulting type after applying the % operator.
source§

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

Performs the % operation. Read more
source§

impl Rem<NonZero<BoxedUint>> for &BoxedUint

§

type Output = BoxedUint

The resulting type after applying the % operator.
source§

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

Performs the % operation. Read more
source§

impl Rem<NonZero<BoxedUint>> for BoxedUint

§

type Output = BoxedUint

The resulting type after applying the % operator.
source§

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

Performs the % operation. Read more
source§

impl RemAssign<&NonZero<BoxedUint>> for BoxedUint

source§

fn rem_assign(&mut self, rhs: &NonZero<BoxedUint>)

Performs the %= operation. Read more
source§

impl RemAssign<NonZero<BoxedUint>> for BoxedUint

source§

fn rem_assign(&mut self, rhs: NonZero<BoxedUint>)

Performs the %= operation. Read more
source§

impl RemLimb for BoxedUint

source§

fn rem_limb_with_reciprocal(&self, reciprocal: &Reciprocal) -> Limb

Computes self % rhs.
source§

fn rem_limb(&self, rhs: NonZero<Limb>) -> Limb

Computes self % rhs using a pre-made reciprocal.
source§

impl Shl<i32> for &BoxedUint

§

type Output = BoxedUint

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

fn shl(self, shift: i32) -> BoxedUint

Performs the << operation. Read more
source§

impl Shl<i32> for BoxedUint

§

type Output = BoxedUint

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

fn shl(self, shift: i32) -> BoxedUint

Performs the << operation. Read more
source§

impl Shl<u32> for &BoxedUint

§

type Output = BoxedUint

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

fn shl(self, shift: u32) -> BoxedUint

Performs the << operation. Read more
source§

impl Shl<u32> for BoxedUint

§

type Output = BoxedUint

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

fn shl(self, shift: u32) -> BoxedUint

Performs the << operation. Read more
source§

impl Shl<usize> for &BoxedUint

§

type Output = BoxedUint

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

fn shl(self, shift: usize) -> BoxedUint

Performs the << operation. Read more
source§

impl Shl<usize> for BoxedUint

§

type Output = BoxedUint

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

fn shl(self, shift: usize) -> BoxedUint

Performs the << operation. Read more
source§

impl ShlAssign<i32> for BoxedUint

source§

fn shl_assign(&mut self, shift: i32)

Performs the <<= operation. Read more
source§

impl ShlAssign<u32> for BoxedUint

source§

fn shl_assign(&mut self, shift: u32)

Performs the <<= operation. Read more
source§

impl ShlAssign<usize> for BoxedUint

source§

fn shl_assign(&mut self, shift: usize)

Performs the <<= operation. Read more
source§

impl ShlVartime for BoxedUint

source§

fn overflowing_shl_vartime(&self, shift: u32) -> CtOption<Self>

Computes self << shift. Read more
source§

fn wrapping_shl_vartime(&self, shift: u32) -> Self

Computes self << shift in a panic-free manner, masking off bits of shift which would cause the shift to exceed the type’s width.
source§

impl Shr<i32> for &BoxedUint

§

type Output = BoxedUint

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

fn shr(self, shift: i32) -> BoxedUint

Performs the >> operation. Read more
source§

impl Shr<i32> for BoxedUint

§

type Output = BoxedUint

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

fn shr(self, shift: i32) -> BoxedUint

Performs the >> operation. Read more
source§

impl Shr<u32> for &BoxedUint

§

type Output = BoxedUint

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

fn shr(self, shift: u32) -> BoxedUint

Performs the >> operation. Read more
source§

impl Shr<u32> for BoxedUint

§

type Output = BoxedUint

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

fn shr(self, shift: u32) -> BoxedUint

Performs the >> operation. Read more
source§

impl Shr<usize> for &BoxedUint

§

type Output = BoxedUint

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

fn shr(self, shift: usize) -> BoxedUint

Performs the >> operation. Read more
source§

impl Shr<usize> for BoxedUint

§

type Output = BoxedUint

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

fn shr(self, shift: usize) -> BoxedUint

Performs the >> operation. Read more
source§

impl ShrAssign<i32> for BoxedUint

source§

fn shr_assign(&mut self, shift: i32)

Performs the >>= operation. Read more
source§

impl ShrAssign<u32> for BoxedUint

source§

fn shr_assign(&mut self, shift: u32)

Performs the >>= operation. Read more
source§

impl ShrAssign<usize> for BoxedUint

source§

fn shr_assign(&mut self, shift: usize)

Performs the >>= operation. Read more
source§

impl ShrVartime for BoxedUint

source§

fn overflowing_shr_vartime(&self, shift: u32) -> CtOption<Self>

Computes self >> shift. Read more
source§

fn wrapping_shr_vartime(&self, shift: u32) -> Self

Computes self >> shift in a panic-free manner, masking off bits of shift which would cause the shift to exceed the type’s width.
source§

impl SquareRoot for BoxedUint

source§

fn sqrt(&self) -> Self

Computes floor(sqrt(self)).
source§

fn sqrt_vartime(&self) -> Self

Computes floor(sqrt(self)), variable time in self.
source§

impl Sub<&BoxedUint> for &BoxedUint

§

type Output = BoxedUint

The resulting type after applying the - operator.
source§

fn sub(self, rhs: &BoxedUint) -> BoxedUint

Performs the - operation. Read more
source§

impl Sub<&BoxedUint> for BoxedUint

§

type Output = BoxedUint

The resulting type after applying the - operator.
source§

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

Performs the - operation. Read more
source§

impl Sub for BoxedUint

§

type Output = BoxedUint

The resulting type after applying the - operator.
source§

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

Performs the - operation. Read more
source§

impl SubMod for BoxedUint

§

type Output = BoxedUint

Output type.
source§

fn sub_mod(&self, rhs: &Self, p: &Self) -> Self

Compute self - rhs mod p. Read more
source§

impl UpperHex for BoxedUint

source§

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

Formats the value using the given formatter.
source§

impl WideningMul<&BoxedUint> for BoxedUint

§

type Output = BoxedUint

Output of the widening multiplication.
source§

fn widening_mul(&self, rhs: &BoxedUint) -> Self

Perform widening multiplication.
source§

impl WideningMul for BoxedUint

§

type Output = BoxedUint

Output of the widening multiplication.
source§

fn widening_mul(&self, rhs: BoxedUint) -> Self

Perform widening multiplication.
source§

impl WrappingAdd for BoxedUint

source§

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

Wrapping (modular) addition. Computes self + other, wrapping around at the boundary of the type.
source§

impl WrappingMul for BoxedUint

source§

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

Wrapping (modular) multiplication. Computes self * other, wrapping around at the boundary of the type.
source§

impl WrappingNeg for BoxedUint

source§

fn wrapping_neg(&self) -> Self

Wrapping (modular) negation. Computes -self, wrapping around at the boundary of the type. Read more
source§

impl WrappingShl for BoxedUint

source§

fn wrapping_shl(&self, shift: u32) -> BoxedUint

Panic-free bitwise shift-left; yields self << mask(rhs), where mask removes any high order bits of rhs that would cause the shift to exceed the bitwidth of the type. Read more
source§

impl WrappingShr for BoxedUint

source§

fn wrapping_shr(&self, shift: u32) -> BoxedUint

Panic-free bitwise shift-right; yields self >> mask(rhs), where mask removes any high order bits of rhs that would cause the shift to exceed the bitwidth of the type. Read more
source§

impl WrappingSub for BoxedUint

source§

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

Wrapping (modular) subtraction. Computes self - other, wrapping around at the boundary of the type.
source§

impl Zero for BoxedUint

source§

fn zero() -> Self

Returns the additive identity element of Self, 0. Read more
source§

fn is_zero(&self) -> bool

Returns true if self is equal to the additive identity.
source§

fn set_zero(&mut self)

Sets self to the additive identity element of Self, 0.
source§

impl Zero for BoxedUint

source§

fn zero() -> Self

The value 0.
source§

fn is_zero(&self) -> Choice

Determine if this value is equal to zero. Read more
source§

fn set_zero(&mut self)

Set self to its additive identity, i.e. Self::zero.
source§

fn zero_like(other: &Self) -> Self
where Self: Clone,

Return the value 0 with the same precision as other.
source§

impl Zeroize for BoxedUint

Available on crate feature zeroize only.
source§

fn zeroize(&mut self)

Zero out this object from memory using Rust intrinsics which ensure the zeroization operation is not “optimized away” by the compiler.
source§

impl Eq for BoxedUint

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

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

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

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

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

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

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

source§

default fn to_string(&self) -> String

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

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

§

type Error = Infallible

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

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

Performs the conversion.
source§

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

§

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

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

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

Performs the conversion.
source§

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