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 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 reminder in a tuple.

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

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

Source§

fn clone(&self) -> FixedUInt<T, N>

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<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: 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> 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: &Self) -> Self::Output

Performs the / operation. Read more
Source§

impl<T: 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: &Self) -> <Self as Div<Self>>::Output

Performs the / operation. Read more
Source§

impl<T: 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: 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: 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 as Div<Self>>::Output

Performs the / operation. Read more
Source§

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

Source§

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

Performs the /= operation. Read more
Source§

impl<T: 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: 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: 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: 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: 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> 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: 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: &Self) -> Self::Output

Performs the * operation. Read more
Source§

impl<T: 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: &Self) -> <Self as Mul<Self>>::Output

Performs the * operation. Read more
Source§

impl<T: 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: 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: 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 as Mul<Self>>::Output

Performs the * operation. Read more
Source§

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

Source§

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

Performs the *= operation. Read more
Source§

impl<T: 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: 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 as Not>::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: 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, const N: usize> PartialEq for FixedUInt<T, N>

Source§

fn eq(&self, other: &FixedUInt<T, N>) -> 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: 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, _: 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, _: 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, n: 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<T: 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: &Self) -> Self::Output

Performs the % operation. Read more
Source§

impl<T: 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: &Self) -> Self

Performs the % operation. Read more
Source§

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

Performs the % operation. Read more
Source§

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

Source§

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

Performs the %= operation. Read more
Source§

impl<T: 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> 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 operator. Returns a+b, saturating at the numeric bounds instead of overflowing.

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 operator. Returns a-b, saturating at the numeric bounds instead of overflowing.

Source§

impl<T: 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: 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: 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: 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 as Shl<usize>>::Output

Performs the << operation. Read more
Source§

impl<T: 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: 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 as Shl<u32>>::Output

Performs the << operation. Read more
Source§

impl<T: 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: 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 as Shl<usize>>::Output

Performs the << operation. Read more
Source§

impl<T: 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: 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: 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: 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: 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: 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 as Shr<usize>>::Output

Performs the >> operation. Read more
Source§

impl<T: 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: 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 as Shr<u32>>::Output

Performs the >> operation. Read more
Source§

impl<T: 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: 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 as Shr<usize>>::Output

Performs the >> operation. Read more
Source§

impl<T: 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: 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: 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: 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: 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: 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 as Sub<Self>>::Output

Performs the - operation. Read more
Source§

impl<T: 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: MachineWord, const N: usize> SubAssign for FixedUInt<T, N>

Source§

fn sub_assign(&mut self, other: Self)

Performs the -= operation. Read more
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, const N: usize> Eq for FixedUInt<T, N>
where T: MachineWord + Eq,

Source§

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

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