Struct fixed_bigint::fixeduint::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
sourceimpl<T: MachineWord, const N: usize> FixedUInt<T, N>
impl<T: MachineWord, const N: usize> FixedUInt<T, N>
sourcepub fn bit_length(&self) -> u32
pub fn bit_length(&self) -> u32
Returns number of used bits.
sourcepub fn div_rem(&self, divisor: &Self) -> (Self, Self)
pub fn div_rem(&self, divisor: &Self) -> (Self, Self)
Performs a division, returning both the quotient and reminder in a tuple.
sourcepub fn from_le_bytes(bytes: &[u8]) -> Self
pub fn from_le_bytes(bytes: &[u8]) -> Self
Create a little-endian integer value from its representation as a byte array in little endian.
Trait Implementations
sourceimpl<T: MachineWord, const N: usize> AddAssign<&'_ FixedUInt<T, N>> for FixedUInt<T, N>
impl<T: MachineWord, const N: usize> AddAssign<&'_ FixedUInt<T, N>> for FixedUInt<T, N>
sourcefn add_assign(&mut self, other: &Self)
fn add_assign(&mut self, other: &Self)
Performs the +=
operation. Read more
sourceimpl<T: MachineWord, const N: usize> AddAssign<FixedUInt<T, N>> for FixedUInt<T, N>
impl<T: MachineWord, const N: usize> AddAssign<FixedUInt<T, N>> for FixedUInt<T, N>
sourcefn add_assign(&mut self, other: Self)
fn add_assign(&mut self, other: Self)
Performs the +=
operation. Read more
sourceimpl<T: MachineWord, const N: usize> BitAndAssign<FixedUInt<T, N>> for FixedUInt<T, N>
impl<T: MachineWord, const N: usize> BitAndAssign<FixedUInt<T, N>> for FixedUInt<T, N>
sourcefn bitand_assign(&mut self, other: Self)
fn bitand_assign(&mut self, other: Self)
Performs the &=
operation. Read more
sourceimpl<T: MachineWord, const N: usize> BitOrAssign<FixedUInt<T, N>> for FixedUInt<T, N>
impl<T: MachineWord, const N: usize> BitOrAssign<FixedUInt<T, N>> for FixedUInt<T, N>
sourcefn bitor_assign(&mut self, other: Self)
fn bitor_assign(&mut self, other: Self)
Performs the |=
operation. Read more
sourceimpl<T: MachineWord, const N: usize> BitXorAssign<FixedUInt<T, N>> for FixedUInt<T, N>
impl<T: MachineWord, const N: usize> BitXorAssign<FixedUInt<T, N>> for FixedUInt<T, N>
sourcefn bitxor_assign(&mut self, other: Self)
fn bitxor_assign(&mut self, other: Self)
Performs the ^=
operation. Read more
sourceimpl<T: MachineWord, const N: usize> Bounded for FixedUInt<T, N>
impl<T: MachineWord, const N: usize> Bounded for FixedUInt<T, N>
sourceimpl<T: MachineWord, const N: usize> CheckedAdd for FixedUInt<T, N>
impl<T: MachineWord, const N: usize> CheckedAdd for FixedUInt<T, N>
sourcefn checked_add(&self, other: &Self) -> Option<Self>
fn checked_add(&self, other: &Self) -> Option<Self>
Adds two numbers, checking for overflow. If overflow happens, None
is
returned. Read more
sourceimpl<T: MachineWord, const N: usize> CheckedDiv for FixedUInt<T, N>
impl<T: MachineWord, const N: usize> CheckedDiv for FixedUInt<T, N>
sourcefn checked_div(&self, other: &Self) -> Option<Self>
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. Read more
sourceimpl<T: MachineWord, const N: usize> CheckedMul for FixedUInt<T, N>
impl<T: MachineWord, const N: usize> CheckedMul for FixedUInt<T, N>
sourcefn checked_mul(&self, other: &Self) -> Option<Self>
fn checked_mul(&self, other: &Self) -> Option<Self>
Multiplies two numbers, checking for underflow or overflow. If underflow
or overflow happens, None
is returned. Read more
sourceimpl<T: MachineWord, const N: usize> CheckedRem for FixedUInt<T, N>
impl<T: MachineWord, const N: usize> CheckedRem for FixedUInt<T, N>
sourcefn checked_rem(&self, other: &Self) -> Option<Self>
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
sourceimpl<T: MachineWord, const N: usize> CheckedShl for FixedUInt<T, N>
impl<T: MachineWord, const N: usize> CheckedShl for FixedUInt<T, N>
sourcefn checked_shl(&self, bits: u32) -> Option<Self>
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
sourceimpl<T: MachineWord, const N: usize> CheckedShr for FixedUInt<T, N>
impl<T: MachineWord, const N: usize> CheckedShr for FixedUInt<T, N>
sourcefn checked_shr(&self, bits: u32) -> Option<Self>
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
sourceimpl<T: MachineWord, const N: usize> CheckedSub for FixedUInt<T, N>
impl<T: MachineWord, const N: usize> CheckedSub for FixedUInt<T, N>
sourcefn checked_sub(&self, other: &Self) -> Option<Self>
fn checked_sub(&self, other: &Self) -> Option<Self>
Subtracts two numbers, checking for underflow. If underflow happens,
None
is returned. Read more
sourceimpl<T: MachineWord, const N: usize> Default for FixedUInt<T, N>
impl<T: MachineWord, const N: usize> Default for FixedUInt<T, N>
sourceimpl<T: MachineWord, const N: usize> DivAssign<&'_ FixedUInt<T, N>> for FixedUInt<T, N>
impl<T: MachineWord, const N: usize> DivAssign<&'_ FixedUInt<T, N>> for FixedUInt<T, N>
sourcefn div_assign(&mut self, other: &Self)
fn div_assign(&mut self, other: &Self)
Performs the /=
operation. Read more
sourceimpl<T: MachineWord, const N: usize> DivAssign<FixedUInt<T, N>> for FixedUInt<T, N>
impl<T: MachineWord, const N: usize> DivAssign<FixedUInt<T, N>> for FixedUInt<T, N>
sourcefn div_assign(&mut self, other: Self)
fn div_assign(&mut self, other: Self)
Performs the /=
operation. Read more
sourceimpl<T: MachineWord, const N: usize> FromPrimitive for FixedUInt<T, N>
impl<T: MachineWord, const N: usize> FromPrimitive for FixedUInt<T, N>
sourcefn from_i64(_: i64) -> Option<Self>
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. Read more
sourcefn from_u64(input: u64) -> Option<Self>
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. Read more
sourcefn from_isize(n: isize) -> Option<Self>
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. Read more
sourcefn from_i8(n: i8) -> Option<Self>
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. Read more
sourcefn from_i16(n: i16) -> Option<Self>
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. Read more
sourcefn from_i32(n: i32) -> Option<Self>
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. Read more
sourcefn from_i128(n: i128) -> Option<Self>
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
sourcefn from_usize(n: usize) -> Option<Self>
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. Read more
sourcefn from_u8(n: u8) -> Option<Self>
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. Read more
sourcefn from_u16(n: u16) -> Option<Self>
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. Read more
sourcefn from_u32(n: u32) -> Option<Self>
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. Read more
sourcefn from_u128(n: u128) -> Option<Self>
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
sourceimpl<T: MachineWord, const N: usize> Integer for FixedUInt<T, N>
impl<T: MachineWord, const N: usize> Integer for FixedUInt<T, N>
sourcefn is_multiple_of(&self, other: &Self) -> bool
fn is_multiple_of(&self, other: &Self) -> bool
Returns true
if self
is a multiple of other
. Read more
sourcefn div_rem(&self, other: &Self) -> (Self, Self)
fn div_rem(&self, other: &Self) -> (Self, Self)
Simultaneous truncated integer division and modulus.
Returns (quotient, remainder)
. Read more
sourcefn gcd_lcm(&self, other: &Self) -> (Self, Self)
fn gcd_lcm(&self, other: &Self) -> (Self, Self)
Greatest Common Divisor (GCD) and Lowest Common Multiple (LCM) together. Read more
sourcefn extended_gcd(&self, other: &Self) -> ExtendedGcd<Self> where
Self: Clone,
fn extended_gcd(&self, other: &Self) -> ExtendedGcd<Self> where
Self: Clone,
Greatest common divisor and Bézout coefficients. Read more
sourcefn extended_gcd_lcm(&self, other: &Self) -> (ExtendedGcd<Self>, Self) where
Self: Clone + Signed,
fn extended_gcd_lcm(&self, other: &Self) -> (ExtendedGcd<Self>, Self) where
Self: Clone + Signed,
Greatest common divisor, least common multiple, and Bézout coefficients.
sourcefn div_mod_floor(&self, other: &Self) -> (Self, Self)
fn div_mod_floor(&self, other: &Self) -> (Self, Self)
Simultaneous floored integer division and modulus.
Returns (quotient, remainder)
. Read more
sourcefn next_multiple_of(&self, other: &Self) -> Self where
Self: Clone,
fn next_multiple_of(&self, other: &Self) -> Self where
Self: Clone,
Rounds up to nearest multiple of argument. Read more
sourcefn prev_multiple_of(&self, other: &Self) -> Self where
Self: Clone,
fn prev_multiple_of(&self, other: &Self) -> Self where
Self: Clone,
Rounds down to nearest multiple of argument. Read more
sourceimpl<T: MachineWord, const N: usize> MulAssign<&'_ FixedUInt<T, N>> for FixedUInt<T, N>
impl<T: MachineWord, const N: usize> MulAssign<&'_ FixedUInt<T, N>> for FixedUInt<T, N>
sourcefn mul_assign(&mut self, other: &Self)
fn mul_assign(&mut self, other: &Self)
Performs the *=
operation. Read more
sourceimpl<T: MachineWord, const N: usize> MulAssign<FixedUInt<T, N>> for FixedUInt<T, N>
impl<T: MachineWord, const N: usize> MulAssign<FixedUInt<T, N>> for FixedUInt<T, N>
sourcefn mul_assign(&mut self, other: Self)
fn mul_assign(&mut self, other: Self)
Performs the *=
operation. Read more
sourceimpl<T: MachineWord, const N: usize> Not for FixedUInt<T, N>
impl<T: MachineWord, const N: usize> Not for FixedUInt<T, N>
sourceimpl<T: MachineWord, const N: usize> Num for FixedUInt<T, N>
impl<T: MachineWord, const N: usize> Num for FixedUInt<T, N>
type FromStrRadixErr = ParseIntError
sourcefn from_str_radix(
input: &str,
radix: u32
) -> Result<Self, <Self as Num>::FromStrRadixErr>
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
sourceimpl<T: MachineWord, const N: usize> NumCast for FixedUInt<T, N>
impl<T: MachineWord, const N: usize> NumCast for FixedUInt<T, N>
sourcefn from<X>(_: X) -> Option<Self> where
T: ToPrimitive,
fn from<X>(_: X) -> Option<Self> where
T: 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
sourceimpl<T: MachineWord, const N: usize> One for FixedUInt<T, N>
impl<T: MachineWord, const N: usize> One for FixedUInt<T, N>
sourceimpl<T: MachineWord, const N: usize> Ord for FixedUInt<T, N>
impl<T: MachineWord, const N: usize> Ord for FixedUInt<T, N>
sourceimpl<T: MachineWord, const N: usize> OverflowingAdd for FixedUInt<T, N>
impl<T: MachineWord, const N: usize> OverflowingAdd for FixedUInt<T, N>
sourceimpl<T: MachineWord, const N: usize> OverflowingMul for FixedUInt<T, N>
impl<T: MachineWord, const N: usize> OverflowingMul for FixedUInt<T, N>
sourceimpl<T: MachineWord, const N: usize> OverflowingShl for FixedUInt<T, N>
impl<T: MachineWord, const N: usize> OverflowingShl for FixedUInt<T, N>
sourceimpl<T: MachineWord, const N: usize> OverflowingShr for FixedUInt<T, N>
impl<T: MachineWord, const N: usize> OverflowingShr for FixedUInt<T, N>
sourceimpl<T: MachineWord, const N: usize> OverflowingSub for FixedUInt<T, N>
impl<T: MachineWord, const N: usize> OverflowingSub for FixedUInt<T, N>
sourceimpl<T: PartialEq, const N: usize> PartialEq<FixedUInt<T, N>> for FixedUInt<T, N> where
T: MachineWord,
impl<T: PartialEq, const N: usize> PartialEq<FixedUInt<T, N>> for FixedUInt<T, N> where
T: MachineWord,
sourceimpl<T: MachineWord, const N: usize> PartialOrd<FixedUInt<T, N>> for FixedUInt<T, N>
impl<T: MachineWord, const N: usize> PartialOrd<FixedUInt<T, N>> for FixedUInt<T, N>
sourcefn partial_cmp(&self, other: &Self) -> Option<Ordering>
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 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<T: MachineWord, const N: usize> PrimInt for FixedUInt<T, N>
impl<T: MachineWord, const N: usize> PrimInt for FixedUInt<T, N>
sourcefn count_ones(self) -> u32
fn count_ones(self) -> u32
Returns the number of ones in the binary representation of self
. Read more
sourcefn count_zeros(self) -> u32
fn count_zeros(self) -> u32
Returns the number of zeros in the binary representation of self
. Read more
sourcefn leading_zeros(self) -> u32
fn leading_zeros(self) -> u32
Returns the number of leading zeros in the binary representation
of self
. Read more
sourcefn trailing_zeros(self) -> u32
fn trailing_zeros(self) -> u32
Returns the number of trailing zeros in the binary representation
of self
. Read more
sourcefn rotate_left(self, bits: u32) -> Self
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
sourcefn rotate_right(self, bits: u32) -> Self
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
sourcefn signed_shl(self, _: u32) -> Self
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
sourcefn signed_shr(self, _: u32) -> Self
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
sourcefn unsigned_shl(self, bits: u32) -> Self
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
sourcefn unsigned_shr(self, bits: u32) -> Self
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
sourcefn swap_bytes(self) -> Self
fn swap_bytes(self) -> Self
Reverses the byte order of the integer. Read more
sourcefn from_be(source: Self) -> Self
fn from_be(source: Self) -> Self
Convert an integer from big endian to the target’s endianness. Read more
sourcefn from_le(source: Self) -> Self
fn from_le(source: Self) -> Self
Convert an integer from little endian to the target’s endianness. Read more
sourcefn pow(self, n: u32) -> Self
fn pow(self, n: u32) -> Self
Raises self to the power of exp
, using exponentiation by squaring. Read more
sourcefn leading_ones(self) -> u32
fn leading_ones(self) -> u32
Returns the number of leading ones in the binary representation
of self
. Read more
sourcefn trailing_ones(self) -> u32
fn trailing_ones(self) -> u32
Returns the number of trailing ones in the binary representation
of self
. Read more
sourcefn reverse_bits(self) -> Self
fn reverse_bits(self) -> Self
Reverses the order of bits in the integer. Read more
sourceimpl<T: MachineWord, const N: usize> RemAssign<&'_ FixedUInt<T, N>> for FixedUInt<T, N>
impl<T: MachineWord, const N: usize> RemAssign<&'_ FixedUInt<T, N>> for FixedUInt<T, N>
sourcefn rem_assign(&mut self, other: &Self)
fn rem_assign(&mut self, other: &Self)
Performs the %=
operation. Read more
sourceimpl<T: MachineWord, const N: usize> RemAssign<FixedUInt<T, N>> for FixedUInt<T, N>
impl<T: MachineWord, const N: usize> RemAssign<FixedUInt<T, N>> for FixedUInt<T, N>
sourcefn rem_assign(&mut self, other: Self)
fn rem_assign(&mut self, other: Self)
Performs the %=
operation. Read more
sourceimpl<T: MachineWord, const N: usize> Saturating for FixedUInt<T, N>
impl<T: MachineWord, const N: usize> Saturating for FixedUInt<T, N>
Note: This is marked deprecated, but still used by PrimInt
sourcefn saturating_add(self, other: Self) -> Self
fn saturating_add(self, other: Self) -> Self
Saturating addition operator. Returns a+b, saturating at the numeric bounds instead of overflowing.
sourcefn saturating_sub(self, other: Self) -> Self
fn saturating_sub(self, other: Self) -> Self
Saturating subtraction operator. Returns a-b, saturating at the numeric bounds instead of overflowing.
sourceimpl<T: MachineWord, const N: usize> SaturatingAdd for FixedUInt<T, N>
impl<T: MachineWord, const N: usize> SaturatingAdd for FixedUInt<T, N>
sourcefn saturating_add(&self, other: &Self) -> Self
fn saturating_add(&self, other: &Self) -> Self
Saturating addition operator. Returns a+b, saturating at the numeric bounds instead of overflowing.
sourceimpl<T: MachineWord, const N: usize> SaturatingMul for FixedUInt<T, N>
impl<T: MachineWord, const N: usize> SaturatingMul for FixedUInt<T, N>
sourcefn saturating_mul(&self, other: &Self) -> Self
fn saturating_mul(&self, other: &Self) -> Self
Saturating multiplication. Computes self * other
, saturating at the relevant high or low boundary of
the type. Read more
sourceimpl<T: MachineWord, const N: usize> SaturatingSub for FixedUInt<T, N>
impl<T: MachineWord, const N: usize> SaturatingSub for FixedUInt<T, N>
sourcefn saturating_sub(&self, other: &Self) -> Self
fn saturating_sub(&self, other: &Self) -> Self
Saturating subtraction operator. Returns a-b, saturating at the numeric bounds instead of overflowing.
sourceimpl<T: MachineWord, const N: usize> ShlAssign<&'_ usize> for FixedUInt<T, N>
impl<T: MachineWord, const N: usize> ShlAssign<&'_ usize> for FixedUInt<T, N>
sourcefn shl_assign(&mut self, bits: &usize)
fn shl_assign(&mut self, bits: &usize)
Performs the <<=
operation. Read more
sourceimpl<T: MachineWord, const N: usize> ShlAssign<usize> for FixedUInt<T, N>
impl<T: MachineWord, const N: usize> ShlAssign<usize> for FixedUInt<T, N>
sourcefn shl_assign(&mut self, bits: usize)
fn shl_assign(&mut self, bits: usize)
Performs the <<=
operation. Read more
sourceimpl<T: MachineWord, const N: usize> ShrAssign<&'_ usize> for FixedUInt<T, N>
impl<T: MachineWord, const N: usize> ShrAssign<&'_ usize> for FixedUInt<T, N>
sourcefn shr_assign(&mut self, bits: &usize)
fn shr_assign(&mut self, bits: &usize)
Performs the >>=
operation. Read more
sourceimpl<T: MachineWord, const N: usize> ShrAssign<usize> for FixedUInt<T, N>
impl<T: MachineWord, const N: usize> ShrAssign<usize> for FixedUInt<T, N>
sourcefn shr_assign(&mut self, bits: usize)
fn shr_assign(&mut self, bits: usize)
Performs the >>=
operation. Read more
sourceimpl<T: MachineWord, const N: usize> SubAssign<&'_ FixedUInt<T, N>> for FixedUInt<T, N>
impl<T: MachineWord, const N: usize> SubAssign<&'_ FixedUInt<T, N>> for FixedUInt<T, N>
sourcefn sub_assign(&mut self, other: &Self)
fn sub_assign(&mut self, other: &Self)
Performs the -=
operation. Read more
sourceimpl<T: MachineWord, const N: usize> SubAssign<FixedUInt<T, N>> for FixedUInt<T, N>
impl<T: MachineWord, const N: usize> SubAssign<FixedUInt<T, N>> for FixedUInt<T, N>
sourcefn sub_assign(&mut self, other: Self)
fn sub_assign(&mut self, other: Self)
Performs the -=
operation. Read more
sourceimpl<T: MachineWord, const N: usize> ToPrimitive for FixedUInt<T, N>
impl<T: MachineWord, const N: usize> ToPrimitive for FixedUInt<T, N>
sourcefn to_i64(&self) -> Option<i64>
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. Read more
sourcefn to_u64(&self) -> Option<u64>
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. Read more
sourcefn to_isize(&self) -> Option<isize>
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. Read more
sourcefn to_i8(&self) -> Option<i8>
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. Read more
sourcefn to_i16(&self) -> Option<i16>
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. Read more
sourcefn to_i32(&self) -> Option<i32>
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. Read more
sourcefn to_i128(&self) -> Option<i128>
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
sourcefn to_usize(&self) -> Option<usize>
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. Read more
sourcefn to_u8(&self) -> Option<u8>
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. Read more
sourcefn to_u16(&self) -> Option<u16>
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. Read more
sourcefn to_u32(&self) -> Option<u32>
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. Read more
sourcefn to_u128(&self) -> Option<u128>
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
sourceimpl<T: MachineWord, const N: usize> WrappingAdd for FixedUInt<T, N>
impl<T: MachineWord, const N: usize> WrappingAdd for FixedUInt<T, N>
sourcefn wrapping_add(&self, other: &Self) -> Self
fn wrapping_add(&self, other: &Self) -> Self
Wrapping (modular) addition. Computes self + other
, wrapping around at the boundary of
the type. Read more
sourceimpl<T: MachineWord, const N: usize> WrappingMul for FixedUInt<T, N>
impl<T: MachineWord, const N: usize> WrappingMul for FixedUInt<T, N>
sourcefn wrapping_mul(&self, other: &Self) -> Self
fn wrapping_mul(&self, other: &Self) -> Self
Wrapping (modular) multiplication. Computes self * other
, wrapping around at the boundary
of the type. Read more
sourceimpl<T: MachineWord, const N: usize> WrappingShl for FixedUInt<T, N>
impl<T: MachineWord, const N: usize> WrappingShl for FixedUInt<T, N>
sourcefn wrapping_shl(&self, bits: u32) -> Self
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
sourceimpl<T: MachineWord, const N: usize> WrappingShr for FixedUInt<T, N>
impl<T: MachineWord, const N: usize> WrappingShr for FixedUInt<T, N>
sourcefn wrapping_shr(&self, bits: u32) -> Self
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
sourceimpl<T: MachineWord, const N: usize> WrappingSub for FixedUInt<T, N>
impl<T: MachineWord, const N: usize> WrappingSub for FixedUInt<T, N>
sourcefn wrapping_sub(&self, other: &Self) -> Self
fn wrapping_sub(&self, other: &Self) -> Self
Wrapping (modular) subtraction. Computes self - other
, wrapping around at the boundary
of the type. Read more
sourceimpl<T: MachineWord, const N: usize> Zero for FixedUInt<T, N>
impl<T: MachineWord, const N: usize> Zero for FixedUInt<T, N>
impl<T: Copy, const N: usize> Copy for FixedUInt<T, N> where
T: MachineWord,
impl<T: Eq, const N: usize> Eq for FixedUInt<T, N> where
T: MachineWord,
impl<T, const N: usize> StructuralEq for FixedUInt<T, N> where
T: MachineWord,
impl<T, const N: usize> StructuralPartialEq for FixedUInt<T, N> where
T: MachineWord,
impl<T: MachineWord, const N: usize> Unsigned for FixedUInt<T, N>
Auto Trait Implementations
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more