Skip to main content

FixedUInt

Struct FixedUInt 

Source
pub struct FixedUInt<T, const N: usize>
where T: MachineWord,
{ /* private fields */ }
Expand description

Fixed-size unsigned integer, represented by array of N words of builtin unsigned type T

Implementations§

Source§

impl<T: MachineWord, const N: usize> FixedUInt<T, N>

Source

pub fn new() -> FixedUInt<T, N>

Creates and zero-initializes a FixedUInt.

Source

pub fn words(&self) -> &[T; N]

Returns the underlying array.

Source

pub fn bit_length(&self) -> u32

Returns number of used bits.

Source

pub fn div_rem(&self, divisor: &Self) -> (Self, Self)

Performs a division, returning both the quotient and remainder in a tuple.

Source§

impl<T: MachineWord, const N: usize> FixedUInt<T, N>

Source

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

Create a little-endian integer value from its representation as a byte array in little endian.

Source

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

Create a big-endian integer value from its representation as a byte array in big endian.

Source§

impl<T: MachineWord, const N: usize> FixedUInt<T, N>

Source

pub fn to_le_bytes<'a>( &self, output_buffer: &'a mut [u8], ) -> Result<&'a [u8], bool>

Converts the FixedUInt into a little-endian byte array.

Source

pub fn to_be_bytes<'a>( &self, output_buffer: &'a mut [u8], ) -> Result<&'a [u8], bool>

Converts the FixedUInt into a big-endian byte array.

Source

pub fn to_hex_str<'a>(&self, result: &'a mut [u8]) -> Result<&'a str, Error>

Converts to hex string, given a buffer. CAVEAT: This method removes any leading zeroes

Source

pub fn to_radix_str<'a>( &self, result: &'a mut [u8], radix: u8, ) -> Result<&'a str, Error>

Converts to decimal string, given a buffer. CAVEAT: This method removes any leading zeroes

Trait Implementations§

Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> Add<&FixedUInt<T, N>> for FixedUInt<T, N>

Source§

type Output = FixedUInt<T, N>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> Add<FixedUInt<T, N>> for &FixedUInt<T, N>

Source§

type Output = FixedUInt<T, N>

The resulting type after applying the + operator.
Source§

fn add(self, other: FixedUInt<T, N>) -> Self::Output

Performs the + operation. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> Add for &FixedUInt<T, N>

Source§

type Output = FixedUInt<T, N>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> Add for FixedUInt<T, N>

Source§

type Output = FixedUInt<T, N>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> AddAssign<&FixedUInt<T, N>> for FixedUInt<T, N>

Source§

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

Performs the += operation. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> AddAssign for FixedUInt<T, N>

Source§

fn add_assign(&mut self, other: Self)

Performs the += operation. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> BitAnd<&FixedUInt<T, N>> for &FixedUInt<T, N>

Source§

type Output = FixedUInt<T, N>

The resulting type after applying the & operator.
Source§

fn bitand(self, other: &FixedUInt<T, N>) -> Self::Output

Performs the & operation. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> BitAnd<&FixedUInt<T, N>> for FixedUInt<T, N>

Source§

type Output = FixedUInt<T, N>

The resulting type after applying the & operator.
Source§

fn bitand(self, other: &FixedUInt<T, N>) -> Self::Output

Performs the & operation. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> BitAnd<FixedUInt<T, N>> for &FixedUInt<T, N>

Source§

type Output = FixedUInt<T, N>

The resulting type after applying the & operator.
Source§

fn bitand(self, other: FixedUInt<T, N>) -> Self::Output

Performs the & operation. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> BitAnd for FixedUInt<T, N>

Source§

type Output = FixedUInt<T, N>

The resulting type after applying the & operator.
Source§

fn bitand(self, other: Self) -> Self::Output

Performs the & operation. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> BitAndAssign for FixedUInt<T, N>

Source§

fn bitand_assign(&mut self, other: Self)

Performs the &= operation. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> BitOr<&FixedUInt<T, N>> for &FixedUInt<T, N>

Source§

type Output = FixedUInt<T, N>

The resulting type after applying the | operator.
Source§

fn bitor(self, other: &FixedUInt<T, N>) -> Self::Output

Performs the | operation. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> BitOr<&FixedUInt<T, N>> for FixedUInt<T, N>

Source§

type Output = FixedUInt<T, N>

The resulting type after applying the | operator.
Source§

fn bitor(self, other: &FixedUInt<T, N>) -> Self::Output

Performs the | operation. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> BitOr<FixedUInt<T, N>> for &FixedUInt<T, N>

Source§

type Output = FixedUInt<T, N>

The resulting type after applying the | operator.
Source§

fn bitor(self, other: FixedUInt<T, N>) -> Self::Output

Performs the | operation. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> BitOr for FixedUInt<T, N>

Source§

type Output = FixedUInt<T, N>

The resulting type after applying the | operator.
Source§

fn bitor(self, other: Self) -> Self::Output

Performs the | operation. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> BitOrAssign for FixedUInt<T, N>

Source§

fn bitor_assign(&mut self, other: Self)

Performs the |= operation. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> BitXor<&FixedUInt<T, N>> for &FixedUInt<T, N>

Source§

type Output = FixedUInt<T, N>

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, other: &FixedUInt<T, N>) -> Self::Output

Performs the ^ operation. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> BitXor<&FixedUInt<T, N>> for FixedUInt<T, N>

Source§

type Output = FixedUInt<T, N>

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, other: &FixedUInt<T, N>) -> Self::Output

Performs the ^ operation. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> BitXor<FixedUInt<T, N>> for &FixedUInt<T, N>

Source§

type Output = FixedUInt<T, N>

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, other: FixedUInt<T, N>) -> Self::Output

Performs the ^ operation. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> BitXor for FixedUInt<T, N>

Source§

type Output = FixedUInt<T, N>

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, other: Self) -> Self::Output

Performs the ^ operation. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> BitXorAssign for FixedUInt<T, N>

Source§

fn bitxor_assign(&mut self, other: Self)

Performs the ^= operation. Read more
Source§

impl<T: MachineWord, const N: usize> Bounded for FixedUInt<T, N>

Source§

fn min_value() -> Self

Returns the smallest finite number this type can represent
Source§

fn max_value() -> Self

Returns the largest finite number this type can represent
Source§

impl<T: MachineWord, const N: usize> CheckedAdd for FixedUInt<T, N>

Source§

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

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

impl<T: MachineWord, const N: usize> CheckedDiv for FixedUInt<T, N>

Source§

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

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

impl<T: MachineWord, const N: usize> CheckedEuclid for FixedUInt<T, N>

Source§

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

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

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

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

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

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

impl<T: MachineWord, const N: usize> CheckedMul for FixedUInt<T, N>

Source§

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

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

impl<T: MachineWord, const N: usize> CheckedRem for FixedUInt<T, N>

Source§

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

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

impl<T: MachineWord, const N: usize> CheckedShl for FixedUInt<T, N>

Source§

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

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

impl<T: MachineWord, const N: usize> CheckedShr for FixedUInt<T, N>

Source§

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

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

impl<T: MachineWord, const N: usize> CheckedSub for FixedUInt<T, N>

Source§

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

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

impl<T: ConstMachineWord + MachineWord, const N: usize> Clone for FixedUInt<T, N>

Source§

fn clone(&self) -> Self

Returns a duplicate 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<T: ConstMachineWord + MachineWord, const N: usize> ConstAbsDiff for FixedUInt<T, N>

Source§

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

Computes the absolute difference between self and other.
Source§

impl<T: ConstMachineWord + ConstBorrowingSub + MachineWord, const N: usize> ConstBorrowingSub for FixedUInt<T, N>

Source§

fn borrowing_sub(self, rhs: Self, borrow: bool) -> (Self, bool)

Calculates self - rhs - borrow, returning (difference, borrow_out). Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> ConstBounded for FixedUInt<T, N>

Source§

fn min_value() -> Self

Returns the smallest value of this type.
Source§

fn max_value() -> Self

Returns the largest value of this type.
Source§

impl<T: ConstMachineWord + ConstCarryingAdd + MachineWord, const N: usize> ConstCarryingAdd for FixedUInt<T, N>

Source§

fn carrying_add(self, rhs: Self, carry: bool) -> (Self, bool)

Calculates self + rhs + carry, returning (sum, carry_out). Read more
Source§

impl<T: ConstMachineWord + ConstCarryingAdd + ConstBorrowingSub + MachineWord, const N: usize> ConstCarryingMul for FixedUInt<T, N>

Source§

fn carrying_mul(self, rhs: Self, carry: Self) -> (Self, Self)

Calculates self * rhs + carry, returning (low, high). Read more
Source§

fn carrying_mul_add(self, rhs: Self, addend: Self, carry: Self) -> (Self, Self)

Calculates self * rhs + addend + carry, returning (low, high). Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> ConstCheckedAdd for FixedUInt<T, N>

Source§

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

Checked addition. Returns None if overflow occurred.
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> ConstCheckedDiv for FixedUInt<T, N>

Source§

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

Checked division. Returns None if the divisor is zero.
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> ConstCheckedEuclid for FixedUInt<T, N>

Source§

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

Checked Euclidean division. Returns None if the divisor is zero.
Source§

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

Checked Euclidean remainder. Returns None if the divisor is zero.
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> ConstCheckedMul for FixedUInt<T, N>

Source§

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

Checked multiplication. Returns None if overflow occurred.
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> ConstCheckedPow for FixedUInt<T, N>

Source§

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

Checked exponentiation. Computes self.pow(exp), returning None if overflow occurred.
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> ConstCheckedRem for FixedUInt<T, N>

Source§

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

Checked remainder. Returns None if the divisor is zero.
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> ConstCheckedShl for FixedUInt<T, N>

Source§

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

Checked shift left. Returns None if the shift amount exceeds bit width.
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> ConstCheckedShr for FixedUInt<T, N>

Source§

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

Checked shift right. Returns None if the shift amount exceeds bit width.
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> ConstCheckedSub for FixedUInt<T, N>

Source§

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

Checked subtraction. Returns None if overflow occurred.
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> ConstDivCeil for FixedUInt<T, N>

Source§

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

Calculates the quotient of self and rhs, rounding up. Read more
Source§

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

Calculates the quotient of self and rhs, rounding up. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> ConstEuclid for FixedUInt<T, N>

Source§

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

Euclidean division. For unsigned integers, same as regular division.
Source§

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

Euclidean remainder. For unsigned integers, same as regular remainder.
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> ConstIlog for FixedUInt<T, N>

Source§

fn ilog2(self) -> u32

Returns the base 2 logarithm of the number, rounded down. Read more
Source§

fn ilog10(self) -> u32

Returns the base 10 logarithm of the number, rounded down. Read more
Source§

fn ilog(self, base: Self) -> u32

Returns the logarithm of the number with respect to an arbitrary base, rounded down. Read more
Source§

fn checked_ilog2(self) -> Option<u32>

Returns the base 2 logarithm of the number, rounded down. Read more
Source§

fn checked_ilog10(self) -> Option<u32>

Returns the base 10 logarithm of the number, rounded down. Read more
Source§

fn checked_ilog(self, base: Self) -> Option<u32>

Returns the logarithm of the number with respect to an arbitrary base, rounded down. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> ConstIsqrt for FixedUInt<T, N>

Source§

fn isqrt(self) -> Self

Returns the integer square root of self.
Source§

fn checked_isqrt(self) -> Option<Self>

Returns the integer square root of self. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> ConstMidpoint for FixedUInt<T, N>

Source§

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

Calculates the midpoint (average) of self and rhs, rounded down. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> ConstMultiple for FixedUInt<T, N>

Source§

fn is_multiple_of(&self, rhs: &Self) -> bool

Returns true if self is a multiple of rhs. Read more
Source§

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

Returns the smallest value greater than or equal to self that is a multiple of rhs. Read more
Source§

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

Returns the smallest value greater than or equal to self that is a multiple of rhs. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> ConstOne for FixedUInt<T, N>

Source§

fn one() -> Self

Returns the multiplicative identity (one).
Source§

fn is_one(&self) -> bool

Returns true if self is one.
Source§

fn set_one(&mut self)

Sets self to one.
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> ConstOverflowingAdd for FixedUInt<T, N>

Source§

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

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

impl<T: ConstMachineWord + MachineWord, const N: usize> ConstOverflowingMul for FixedUInt<T, N>

Source§

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

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

impl<T: ConstMachineWord + MachineWord, const N: usize> ConstOverflowingShl for FixedUInt<T, N>

Source§

fn overflowing_shl(&self, bits: u32) -> (Self, bool)

Shift left with overflow detection. Returns the shifted value and whether the shift amount exceeded the bit width.
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> ConstOverflowingShr for FixedUInt<T, N>

Source§

fn overflowing_shr(&self, bits: u32) -> (Self, bool)

Shift right with overflow detection. Returns the shifted value and whether the shift amount exceeded the bit width.
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> ConstOverflowingSub for FixedUInt<T, N>

Source§

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

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

impl<T: ConstMachineWord + MachineWord, const N: usize> ConstPowerOfTwo for FixedUInt<T, N>

Source§

fn is_power_of_two(&self) -> bool

Returns true if self is a power of two. Read more
Source§

fn next_power_of_two(self) -> Self

Returns the smallest power of two greater than or equal to self. Read more
Source§

fn checked_next_power_of_two(self) -> Option<Self>

Returns the smallest power of two greater than or equal to self. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> ConstPrimInt for FixedUInt<T, N>

Source§

fn count_ones(self) -> u32

Source§

fn count_zeros(self) -> u32

Source§

fn leading_zeros(self) -> u32

Source§

fn trailing_zeros(self) -> u32

Source§

fn swap_bytes(self) -> Self

Source§

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

Source§

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

Source§

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

Source§

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

Source§

fn reverse_bits(self) -> Self

Source§

fn from_be(x: Self) -> Self

Source§

fn from_le(x: Self) -> Self

Source§

fn to_be(self) -> Self

Source§

fn to_le(self) -> Self

Source§

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

Source§

fn leading_ones(self) -> u32

Source§

fn trailing_ones(self) -> u32

Source§

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

Source§

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

Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> ConstSaturatingAdd for FixedUInt<T, N>

Source§

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

Saturating addition. Computes self + v, saturating at max_value().
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> ConstSaturatingMul for FixedUInt<T, N>

Source§

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

Saturating multiplication. Computes self * v, saturating at max_value().
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> ConstSaturatingSub for FixedUInt<T, N>

Source§

fn saturating_sub(&self, other: &Self) -> Self

Saturating subtraction. Computes self - v, saturating at zero.
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> ConstUnboundedShift for FixedUInt<T, N>

Source§

fn unbounded_shl(self, rhs: u32) -> Self

Unbounded shift left. Returns 0 if rhs is greater than or equal to the bit width of the type.
Source§

fn unbounded_shr(self, rhs: u32) -> Self

Unbounded shift right. Returns 0 if rhs is greater than or equal to the bit width of the type.
Source§

impl<T: ConstMachineWord + ConstCarryingAdd + ConstBorrowingSub + MachineWord, const N: usize> ConstWideningMul for FixedUInt<T, N>

Source§

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

Calculates the complete product self * rhs without overflow. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> ConstWrappingAdd for FixedUInt<T, N>

Source§

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

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

impl<T: ConstMachineWord + MachineWord, const N: usize> ConstWrappingMul for FixedUInt<T, N>

Source§

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

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

impl<T: ConstMachineWord + MachineWord, const N: usize> ConstWrappingShl for FixedUInt<T, N>

Source§

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

Wrapping shift left. Shifts, masking the shift amount to the bit width.
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> ConstWrappingShr for FixedUInt<T, N>

Source§

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

Wrapping shift right. Shifts, masking the shift amount to the bit width.
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> ConstWrappingSub for FixedUInt<T, N>

Source§

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

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

impl<T: ConstMachineWord + MachineWord, const N: usize> ConstZero for FixedUInt<T, N>

Source§

fn zero() -> Self

Returns the additive identity (zero).
Source§

fn is_zero(&self) -> bool

Returns true if self is zero.
Source§

fn set_zero(&mut self)

Sets self to zero.
Source§

impl<T, const N: usize> Debug for FixedUInt<T, N>
where T: MachineWord + Debug,

Source§

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

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

impl<T: ConstMachineWord + MachineWord, const N: usize> Default for FixedUInt<T, N>

Source§

fn default() -> Self

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

impl<T: MachineWord, const N: usize> Display for FixedUInt<T, N>

Source§

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

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

impl<T: ConstMachineWord + MachineWord, const N: usize> Div<&FixedUInt<T, N>> for &FixedUInt<T, N>

Source§

type Output = FixedUInt<T, N>

The resulting type after applying the / operator.
Source§

fn div(self, other: &FixedUInt<T, N>) -> Self::Output

Performs the / operation. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> Div<&FixedUInt<T, N>> for FixedUInt<T, N>

Source§

type Output = FixedUInt<T, N>

The resulting type after applying the / operator.
Source§

fn div(self, other: &FixedUInt<T, N>) -> Self::Output

Performs the / operation. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> Div<FixedUInt<T, N>> for &FixedUInt<T, N>

Source§

type Output = FixedUInt<T, N>

The resulting type after applying the / operator.
Source§

fn div(self, other: FixedUInt<T, N>) -> Self::Output

Performs the / operation. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> Div for FixedUInt<T, N>

Source§

type Output = FixedUInt<T, N>

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> DivAssign<&FixedUInt<T, N>> for FixedUInt<T, N>

Source§

fn div_assign(&mut self, other: &FixedUInt<T, N>)

Performs the /= operation. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> DivAssign for FixedUInt<T, N>

Source§

fn div_assign(&mut self, other: Self)

Performs the /= operation. Read more
Source§

impl<T: MachineWord, const N: usize> Euclid for FixedUInt<T, N>

Source§

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

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

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

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

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

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

impl<T, const N: usize> From<[T; N]> for FixedUInt<T, N>
where T: MachineWord,

Source§

fn from(array: [T; N]) -> Self

Converts to this type from the input type.
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> From<u16> for FixedUInt<T, N>

Source§

fn from(x: u16) -> Self

Converts to this type from the input type.
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> From<u32> for FixedUInt<T, N>

Source§

fn from(x: u32) -> Self

Converts to this type from the input type.
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> From<u64> for FixedUInt<T, N>

Source§

fn from(x: u64) -> Self

Converts to this type from the input type.
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> From<u8> for FixedUInt<T, N>

Source§

fn from(x: u8) -> Self

Converts to this type from the input type.
Source§

impl<T: MachineWord, const N: usize> FromPrimitive for FixedUInt<T, N>

Source§

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

impl<T: MachineWord, const N: usize> FromStr for FixedUInt<T, N>

Source§

type Err = ParseIntError

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

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

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

impl<T: MachineWord, const N: usize> Integer for FixedUInt<T, N>

Source§

fn div_floor(&self, other: &Self) -> Self

Floored integer division. Read more
Source§

fn mod_floor(&self, other: &Self) -> Self

Floored integer modulo, satisfying: Read more
Source§

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

Greatest Common Divisor (GCD). Read more
Source§

fn lcm(&self, other: &Self) -> Self

Lowest Common Multiple (LCM). Read more
Source§

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

👎Deprecated: Please use is_multiple_of instead
Deprecated, use is_multiple_of instead.
Source§

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

Returns true if self is a multiple of other. Read more
Source§

fn is_even(&self) -> bool

Returns true if the number is even. Read more
Source§

fn is_odd(&self) -> bool

Returns true if the number is odd. Read more
Source§

fn div_rem(&self, other: &Self) -> (Self, Self)

Simultaneous truncated integer division and modulus. Returns (quotient, remainder). Read more
Source§

fn div_ceil(&self, other: &Self) -> Self

Ceiled integer division. Read more
Source§

fn gcd_lcm(&self, other: &Self) -> (Self, Self)

Greatest Common Divisor (GCD) and Lowest Common Multiple (LCM) together. Read more
Source§

fn extended_gcd(&self, other: &Self) -> ExtendedGcd<Self>
where Self: Clone,

Greatest common divisor and Bézout coefficients. Read more
Source§

fn div_mod_floor(&self, other: &Self) -> (Self, Self)

Simultaneous floored integer division and modulus. Returns (quotient, remainder). Read more
Source§

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

Rounds up to nearest multiple of argument. Read more
Source§

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

Rounds down to nearest multiple of argument. Read more
Source§

fn dec(&mut self)
where Self: Clone,

Decrements self by one. Read more
Source§

fn inc(&mut self)
where Self: Clone,

Increments self by one. Read more
Source§

impl<T: MachineWord, const N: usize> LowerHex for FixedUInt<T, N>
where u8: TryFrom<T>,

Source§

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

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

impl<T: ConstMachineWord + MachineWord, const N: usize> Mul<&&FixedUInt<T, N>> for &FixedUInt<T, N>

Source§

type Output = FixedUInt<T, N>

The resulting type after applying the * operator.
Source§

fn mul(self, other: &&FixedUInt<T, N>) -> Self::Output

Performs the * operation. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> Mul<&FixedUInt<T, N>> for &FixedUInt<T, N>

Source§

type Output = FixedUInt<T, N>

The resulting type after applying the * operator.
Source§

fn mul(self, other: &FixedUInt<T, N>) -> Self::Output

Performs the * operation. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> Mul<&FixedUInt<T, N>> for FixedUInt<T, N>

Source§

type Output = FixedUInt<T, N>

The resulting type after applying the * operator.
Source§

fn mul(self, other: &FixedUInt<T, N>) -> Self::Output

Performs the * operation. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> Mul<FixedUInt<T, N>> for &FixedUInt<T, N>

Source§

type Output = FixedUInt<T, N>

The resulting type after applying the * operator.
Source§

fn mul(self, other: FixedUInt<T, N>) -> Self::Output

Performs the * operation. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> Mul for FixedUInt<T, N>

Source§

type Output = FixedUInt<T, N>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> MulAssign<&FixedUInt<T, N>> for FixedUInt<T, N>

Source§

fn mul_assign(&mut self, other: &FixedUInt<T, N>)

Performs the *= operation. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> MulAssign for FixedUInt<T, N>

Source§

fn mul_assign(&mut self, other: Self)

Performs the *= operation. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> Not for FixedUInt<T, N>

Source§

type Output = FixedUInt<T, N>

The resulting type after applying the ! operator.
Source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
Source§

impl<T: MachineWord, const N: usize> Num for FixedUInt<T, N>

Source§

type FromStrRadixErr = ParseIntError

Source§

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

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

impl<T: MachineWord, const N: usize> NumCast for FixedUInt<T, N>

Source§

fn from<X>(arg: X) -> Option<Self>
where X: ToPrimitive,

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

impl<T: MachineWord, const N: usize> One for FixedUInt<T, N>

Source§

fn one() -> Self

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

fn set_one(&mut self)

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

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

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

impl<T: ConstMachineWord + MachineWord, const N: usize> Ord for FixedUInt<T, N>

Source§

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

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

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

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

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

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

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

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

impl<T: MachineWord, const N: usize> OverflowingAdd for FixedUInt<T, N>

Source§

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

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

impl<T: MachineWord, const N: usize> OverflowingMul for FixedUInt<T, N>

Source§

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

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

impl<T: MachineWord, const N: usize> OverflowingShl for FixedUInt<T, N>

Source§

fn overflowing_shl(self, bits: u32) -> (Self, bool)

Source§

impl<T: MachineWord, const N: usize> OverflowingShr for FixedUInt<T, N>

Source§

fn overflowing_shr(self, bits: u32) -> (Self, bool)

Source§

impl<T: MachineWord, const N: usize> OverflowingSub for FixedUInt<T, N>

Source§

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

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

impl<T: ConstMachineWord + MachineWord, const N: usize> PartialEq for FixedUInt<T, N>

Source§

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

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

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

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

impl<T: ConstMachineWord + MachineWord, const N: usize> PartialOrd for FixedUInt<T, N>

Source§

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

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

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

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

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

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

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

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

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

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

impl<T: MachineWord, const N: usize> PrimInt for FixedUInt<T, N>

Source§

fn count_ones(self) -> u32

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

fn count_zeros(self) -> u32

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

fn leading_zeros(self) -> u32

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

fn trailing_zeros(self) -> u32

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

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

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

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

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

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

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

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

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

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

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

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

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

fn swap_bytes(self) -> Self

Reverses the byte order of the integer. Read more
Source§

fn from_be(source: Self) -> Self

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

fn from_le(source: Self) -> Self

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

fn to_be(self) -> Self

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

fn to_le(self) -> Self

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

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

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

fn leading_ones(self) -> u32

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

fn trailing_ones(self) -> u32

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

fn reverse_bits(self) -> Self

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

impl<'a, T: MachineWord, const N: usize> Product<&'a FixedUInt<T, N>> for FixedUInt<T, N>

Source§

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

Takes an iterator and generates Self from the elements by multiplying the items.
Source§

impl<T: MachineWord, const N: usize> Product for FixedUInt<T, N>

Source§

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

Takes an iterator and generates Self from the elements by multiplying the items.
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> Rem<&FixedUInt<T, N>> for &FixedUInt<T, N>

Source§

type Output = FixedUInt<T, N>

The resulting type after applying the % operator.
Source§

fn rem(self, other: &FixedUInt<T, N>) -> Self::Output

Performs the % operation. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> Rem<&FixedUInt<T, N>> for FixedUInt<T, N>

Source§

type Output = FixedUInt<T, N>

The resulting type after applying the % operator.
Source§

fn rem(self, other: &FixedUInt<T, N>) -> Self::Output

Performs the % operation. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> Rem<FixedUInt<T, N>> for &FixedUInt<T, N>

Source§

type Output = FixedUInt<T, N>

The resulting type after applying the % operator.
Source§

fn rem(self, other: FixedUInt<T, N>) -> Self::Output

Performs the % operation. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> Rem for FixedUInt<T, N>

Source§

type Output = FixedUInt<T, N>

The resulting type after applying the % operator.
Source§

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

Performs the % operation. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> RemAssign<&FixedUInt<T, N>> for FixedUInt<T, N>

Source§

fn rem_assign(&mut self, other: &FixedUInt<T, N>)

Performs the %= operation. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> RemAssign for FixedUInt<T, N>

Source§

fn rem_assign(&mut self, other: Self)

Performs the %= operation. Read more
Source§

impl<T: MachineWord, const N: usize> Roots for FixedUInt<T, N>

Source§

fn nth_root(&self, n: u32) -> Self

Returns the truncated principal nth root of an integer – if x >= 0 { ⌊ⁿ√x⌋ } else { ⌈ⁿ√x⌉ } Read more
Source§

fn sqrt(&self) -> Self

Returns the truncated principal square root of an integer – ⌊√x⌋ Read more
Source§

fn cbrt(&self) -> Self

Returns the truncated principal cube root of an integer – if x >= 0 { ⌊∛x⌋ } else { ⌈∛x⌉ } Read more
Source§

impl<T: MachineWord, const N: usize> Saturating for FixedUInt<T, N>

Note: This is marked deprecated, but still used by PrimInt

Source§

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

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

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

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

impl<T: MachineWord, const N: usize> SaturatingAdd for FixedUInt<T, N>

Source§

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

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

impl<T: MachineWord, const N: usize> SaturatingMul for FixedUInt<T, N>

Source§

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

Saturating multiplication. Computes self * other, saturating at the relevant high or low boundary of the type.
Source§

impl<T: MachineWord, const N: usize> SaturatingSub for FixedUInt<T, N>

Source§

fn saturating_sub(&self, other: &Self) -> Self

Saturating subtraction. Computes self - other, saturating at the relevant high or low boundary of the type.
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> Shl<&u32> for &FixedUInt<T, N>

Source§

type Output = FixedUInt<T, N>

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

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

Performs the << operation. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> Shl<&u32> for FixedUInt<T, N>

Source§

type Output = FixedUInt<T, N>

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

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

Performs the << operation. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> Shl<&usize> for &FixedUInt<T, N>

Source§

type Output = FixedUInt<T, N>

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

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

Performs the << operation. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> Shl<&usize> for FixedUInt<T, N>

Source§

type Output = FixedUInt<T, N>

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

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

Performs the << operation. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> Shl<u32> for &FixedUInt<T, N>

Source§

type Output = FixedUInt<T, N>

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

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

Performs the << operation. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> Shl<u32> for FixedUInt<T, N>

Source§

type Output = FixedUInt<T, N>

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

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

Performs the << operation. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> Shl<usize> for &FixedUInt<T, N>

Source§

type Output = FixedUInt<T, N>

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

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

Performs the << operation. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> Shl<usize> for FixedUInt<T, N>

Source§

type Output = FixedUInt<T, N>

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

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

Performs the << operation. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> ShlAssign<&usize> for FixedUInt<T, N>

Source§

fn shl_assign(&mut self, bits: &usize)

Performs the <<= operation. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> ShlAssign<usize> for FixedUInt<T, N>

Source§

fn shl_assign(&mut self, bits: usize)

Performs the <<= operation. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> Shr<&u32> for &FixedUInt<T, N>

Source§

type Output = FixedUInt<T, N>

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

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

Performs the >> operation. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> Shr<&u32> for FixedUInt<T, N>

Source§

type Output = FixedUInt<T, N>

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

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

Performs the >> operation. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> Shr<&usize> for &FixedUInt<T, N>

Source§

type Output = FixedUInt<T, N>

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

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

Performs the >> operation. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> Shr<&usize> for FixedUInt<T, N>

Source§

type Output = FixedUInt<T, N>

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

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

Performs the >> operation. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> Shr<u32> for &FixedUInt<T, N>

Source§

type Output = FixedUInt<T, N>

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

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

Performs the >> operation. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> Shr<u32> for FixedUInt<T, N>

Source§

type Output = FixedUInt<T, N>

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

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

Performs the >> operation. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> Shr<usize> for &FixedUInt<T, N>

Source§

type Output = FixedUInt<T, N>

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

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

Performs the >> operation. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> Shr<usize> for FixedUInt<T, N>

Source§

type Output = FixedUInt<T, N>

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

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

Performs the >> operation. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> ShrAssign<&usize> for FixedUInt<T, N>

Source§

fn shr_assign(&mut self, bits: &usize)

Performs the >>= operation. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> ShrAssign<usize> for FixedUInt<T, N>

Source§

fn shr_assign(&mut self, bits: usize)

Performs the >>= operation. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> Sub<&FixedUInt<T, N>> for FixedUInt<T, N>

Source§

type Output = FixedUInt<T, N>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> Sub<FixedUInt<T, N>> for &FixedUInt<T, N>

Source§

type Output = FixedUInt<T, N>

The resulting type after applying the - operator.
Source§

fn sub(self, other: FixedUInt<T, N>) -> Self::Output

Performs the - operation. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> Sub for &FixedUInt<T, N>

Source§

type Output = FixedUInt<T, N>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> Sub for FixedUInt<T, N>

Source§

type Output = FixedUInt<T, N>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> SubAssign<&FixedUInt<T, N>> for FixedUInt<T, N>

Source§

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

Performs the -= operation. Read more
Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> SubAssign for FixedUInt<T, N>

Source§

fn sub_assign(&mut self, other: Self)

Performs the -= operation. Read more
Source§

impl<'a, T: MachineWord, const N: usize> Sum<&'a FixedUInt<T, N>> for FixedUInt<T, N>

Source§

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

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

impl<T: MachineWord, const N: usize> Sum for FixedUInt<T, N>

Source§

fn sum<I: Iterator<Item = Self>>(iter: I) -> Self

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

impl<T: MachineWord, const N: usize> ToPrimitive for FixedUInt<T, N>

Source§

fn to_i64(&self) -> Option<i64>

Converts the value of self to an i64. If the value cannot be represented by an i64, then None is returned.
Source§

fn to_u64(&self) -> Option<u64>

Converts the value of self to a u64. If the value cannot be represented by a u64, then None is returned.
Source§

fn to_isize(&self) -> Option<isize>

Converts the value of self to an isize. If the value cannot be represented by an isize, then None is returned.
Source§

fn to_i8(&self) -> Option<i8>

Converts the value of self to an i8. If the value cannot be represented by an i8, then None is returned.
Source§

fn to_i16(&self) -> Option<i16>

Converts the value of self to an i16. If the value cannot be represented by an i16, then None is returned.
Source§

fn to_i32(&self) -> Option<i32>

Converts the value of self to an i32. If the value cannot be represented by an i32, then None is returned.
Source§

fn to_i128(&self) -> Option<i128>

Converts the value of self to an i128. If the value cannot be represented by an i128 (i64 under the default implementation), then None is returned. Read more
Source§

fn to_usize(&self) -> Option<usize>

Converts the value of self to a usize. If the value cannot be represented by a usize, then None is returned.
Source§

fn to_u8(&self) -> Option<u8>

Converts the value of self to a u8. If the value cannot be represented by a u8, then None is returned.
Source§

fn to_u16(&self) -> Option<u16>

Converts the value of self to a u16. If the value cannot be represented by a u16, then None is returned.
Source§

fn to_u32(&self) -> Option<u32>

Converts the value of self to a u32. If the value cannot be represented by a u32, then None is returned.
Source§

fn to_u128(&self) -> Option<u128>

Converts the value of self to a u128. If the value cannot be represented by a u128 (u64 under the default implementation), then None is returned. Read more
Source§

fn to_f32(&self) -> Option<f32>

Converts the value of self to an f32. Overflows may map to positive or negative inifinity, otherwise None is returned if the value cannot be represented by an f32.
Source§

fn to_f64(&self) -> Option<f64>

Converts the value of self to an f64. Overflows may map to positive or negative inifinity, otherwise None is returned if the value cannot be represented by an f64. Read more
Source§

impl<T: MachineWord, const N: usize> UpperHex for FixedUInt<T, N>
where u8: TryFrom<T>,

Source§

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

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

impl<T: MachineWord, const N: usize> WrappingAdd for FixedUInt<T, N>

Source§

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

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

impl<T: MachineWord, const N: usize> WrappingMul for FixedUInt<T, N>

Source§

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

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

impl<T: MachineWord, const N: usize> WrappingShl for FixedUInt<T, N>

Source§

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

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

impl<T: MachineWord, const N: usize> WrappingShr for FixedUInt<T, N>

Source§

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

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

impl<T: MachineWord, const N: usize> WrappingSub for FixedUInt<T, N>

Source§

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

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

impl<T: MachineWord, const N: usize> Zero for FixedUInt<T, N>

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<T, const N: usize> Copy for FixedUInt<T, N>
where T: MachineWord + Copy,

Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> Eq for FixedUInt<T, N>

Source§

impl<T: MachineWord, const N: usize> Unsigned for FixedUInt<T, N>

Auto Trait Implementations§

§

impl<T, const N: usize> Freeze for FixedUInt<T, N>
where T: Freeze,

§

impl<T, const N: usize> RefUnwindSafe for FixedUInt<T, N>
where T: RefUnwindSafe,

§

impl<T, const N: usize> Send for FixedUInt<T, N>
where T: Send,

§

impl<T, const N: usize> Sync for FixedUInt<T, N>
where T: Sync,

§

impl<T, const N: usize> Unpin for FixedUInt<T, N>
where T: Unpin,

§

impl<T, const N: usize> UnsafeUnpin for FixedUInt<T, N>
where T: UnsafeUnpin,

§

impl<T, const N: usize> UnwindSafe for FixedUInt<T, N>
where T: UnwindSafe,

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<I> Average for I
where &'a I: for<'a, 'b> BitAnd<&'b I, Output = I> + for<'a, 'b> BitOr<&'b I, Output = I> + for<'a, 'b> BitXor<&'b I, Output = I>, I: Integer + Shr<usize, Output = I>,

Source§

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

Returns the ceil value of the average of self and other.

Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

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

Source§

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

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

impl<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> LowerBounded for T
where T: Bounded,

Source§

fn min_value() -> T

Returns the smallest finite number this type can represent
Source§

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

Source§

type Error = Infallible

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

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

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.
Source§

impl<T> UpperBounded for T
where T: Bounded,

Source§

fn max_value() -> T

Returns the largest finite number this type can represent
Source§

impl<T> NumAssign for T
where T: Num + NumAssignOps,

Source§

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

Source§

impl<T> NumAssignRef for T
where T: NumAssign + for<'r> NumAssignOps<&'r T>,

Source§

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

Source§

impl<T> NumRef for T
where T: Num + for<'r> NumOps<&'r T>,

Source§

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