pub struct UInt<T, const BITS: usize> { /* private fields */ }Implementations§
Source§impl<T: Copy, const BITS: usize> UInt<T, BITS>
impl<T: Copy, const BITS: usize> UInt<T, BITS>
pub const BITS: usize = BITS
Sourcepub const unsafe fn new_unchecked(value: T) -> Self
pub const unsafe fn new_unchecked(value: T) -> Self
Source§impl<const BITS: usize> UInt<u8, BITS>
impl<const BITS: usize> UInt<u8, BITS>
Sourcepub const fn new(value: u8) -> Self
pub const fn new(value: u8) -> Self
Creates an instance. Panics if the given value is outside of the valid range
Sourcepub const fn from_u8(value: u8) -> Self
pub const fn from_u8(value: u8) -> Self
Creates an instance. Panics if the given value is outside of the valid range
Sourcepub const fn from_u16(value: u16) -> Self
pub const fn from_u16(value: u16) -> Self
Creates an instance. Panics if the given value is outside of the valid range
Sourcepub const fn from_u32(value: u32) -> Self
pub const fn from_u32(value: u32) -> Self
Creates an instance. Panics if the given value is outside of the valid range
Sourcepub const fn from_u64(value: u64) -> Self
pub const fn from_u64(value: u64) -> Self
Creates an instance. Panics if the given value is outside of the valid range
Sourcepub const fn from_u128(value: u128) -> Self
pub const fn from_u128(value: u128) -> Self
Creates an instance. Panics if the given value is outside of the valid range
Sourcepub const fn try_new(value: u8) -> Result<Self, TryNewError>
pub const fn try_new(value: u8) -> Result<Self, TryNewError>
Creates an instance or an error if the given value is outside of the valid range
pub const fn extract(value: u8, start_bit: usize) -> Self
Sourcepub const fn extract_u8(value: u8, start_bit: usize) -> Self
pub const fn extract_u8(value: u8, start_bit: usize) -> Self
Extracts bits from a given value. The extract is equivalent to: new((value >> start_bit) & MASK)
Unlike new, extract doesn’t perform range-checking so it is slightly more efficient.
panics if start_bit+
Sourcepub const fn extract_u16(value: u16, start_bit: usize) -> Self
pub const fn extract_u16(value: u16, start_bit: usize) -> Self
Extracts bits from a given value. The extract is equivalent to: new((value >> start_bit) & MASK)
Unlike new, extract doesn’t perform range-checking so it is slightly more efficient
panics if start_bit+
Sourcepub const fn extract_u32(value: u32, start_bit: usize) -> Self
pub const fn extract_u32(value: u32, start_bit: usize) -> Self
Extracts bits from a given value. The extract is equivalent to: new((value >> start_bit) & MASK)
Unlike new, extract doesn’t perform range-checking so it is slightly more efficient
panics if start_bit+
Sourcepub const fn extract_u64(value: u64, start_bit: usize) -> Self
pub const fn extract_u64(value: u64, start_bit: usize) -> Self
Extracts bits from a given value. The extract is equivalent to: new((value >> start_bit) & MASK)
Unlike new, extract doesn’t perform range-checking so it is slightly more efficient
panics if start_bit+
Sourcepub const fn extract_u128(value: u128, start_bit: usize) -> Self
pub const fn extract_u128(value: u128, start_bit: usize) -> Self
Extracts bits from a given value. The extract is equivalent to: new((value >> start_bit) & MASK)
Unlike new, extract doesn’t perform range-checking so it is slightly more efficient
panics if start_bit+
Sourcepub const fn widen<const BITS_RESULT: usize>(self) -> UInt<u8, BITS_RESULT>
pub const fn widen<const BITS_RESULT: usize>(self) -> UInt<u8, BITS_RESULT>
Returns a UInt with a wider bit depth but with the same base data type
pub const fn wrapping_add(self, rhs: Self) -> Self
pub const fn wrapping_sub(self, rhs: Self) -> Self
pub const fn wrapping_mul(self, rhs: Self) -> Self
pub const fn wrapping_div(self, rhs: Self) -> Self
pub const fn wrapping_shl(self, rhs: u32) -> Self
pub const fn wrapping_shr(self, rhs: u32) -> Self
pub const fn saturating_add(self, rhs: Self) -> Self
pub const fn saturating_sub(self, rhs: Self) -> Self
pub const fn saturating_mul(self, rhs: Self) -> Self
pub const fn saturating_div(self, rhs: Self) -> Self
pub const fn saturating_pow(self, exp: u32) -> Self
pub const fn checked_add(self, rhs: Self) -> Option<Self>
pub const fn checked_sub(self, rhs: Self) -> Option<Self>
pub const fn checked_mul(self, rhs: Self) -> Option<Self>
pub const fn checked_div(self, rhs: Self) -> Option<Self>
pub const fn checked_shl(self, rhs: u32) -> Option<Self>
pub const fn checked_shr(self, rhs: u32) -> Option<Self>
pub const fn overflowing_add(self, rhs: Self) -> (Self, bool)
pub const fn overflowing_sub(self, rhs: Self) -> (Self, bool)
pub const fn overflowing_mul(self, rhs: Self) -> (Self, bool)
pub const fn overflowing_div(self, rhs: Self) -> (Self, bool)
pub const fn overflowing_shl(self, rhs: u32) -> (Self, bool)
pub const fn overflowing_shr(self, rhs: u32) -> (Self, bool)
Sourcepub const fn reverse_bits(self) -> Self
pub const fn reverse_bits(self) -> Self
Reverses the order of bits in the integer. The least significant bit becomes the most significant bit, second least-significant bit becomes second most-significant bit, etc.
Sourcepub const fn count_ones(self) -> u32
pub const fn count_ones(self) -> u32
Returns the number of ones in the binary representation of self.
Sourcepub const fn count_zeros(self) -> u32
pub const fn count_zeros(self) -> u32
Returns the number of zeros in the binary representation of self.
Sourcepub const fn leading_ones(self) -> u32
pub const fn leading_ones(self) -> u32
Returns the number of leading ones in the binary representation of self.
Sourcepub const fn leading_zeros(self) -> u32
pub const fn leading_zeros(self) -> u32
Returns the number of leading zeros in the binary representation of self.
Sourcepub const fn trailing_ones(self) -> u32
pub const fn trailing_ones(self) -> u32
Returns the number of leading ones in the binary representation of self.
Sourcepub const fn trailing_zeros(self) -> u32
pub const fn trailing_zeros(self) -> u32
Returns the number of leading zeros in the binary representation of self.
Sourcepub const fn rotate_left(self, n: u32) -> Self
pub const fn rotate_left(self, n: u32) -> Self
Shifts the bits to the left by a specified amount, n, wrapping the truncated bits to the end of the resulting integer. Please note this isn’t the same operation as the << shifting operator!
Sourcepub const fn rotate_right(self, n: u32) -> Self
pub const fn rotate_right(self, n: u32) -> Self
Shifts the bits to the right by a specified amount, n, wrapping the truncated bits to the beginning of the resulting integer. Please note this isn’t the same operation as the >> shifting operator!
Source§impl<const BITS: usize> UInt<u16, BITS>
impl<const BITS: usize> UInt<u16, BITS>
Sourcepub const fn new(value: u16) -> Self
pub const fn new(value: u16) -> Self
Creates an instance. Panics if the given value is outside of the valid range
Sourcepub const fn from_u8(value: u8) -> Self
pub const fn from_u8(value: u8) -> Self
Creates an instance. Panics if the given value is outside of the valid range
Sourcepub const fn from_u16(value: u16) -> Self
pub const fn from_u16(value: u16) -> Self
Creates an instance. Panics if the given value is outside of the valid range
Sourcepub const fn from_u32(value: u32) -> Self
pub const fn from_u32(value: u32) -> Self
Creates an instance. Panics if the given value is outside of the valid range
Sourcepub const fn from_u64(value: u64) -> Self
pub const fn from_u64(value: u64) -> Self
Creates an instance. Panics if the given value is outside of the valid range
Sourcepub const fn from_u128(value: u128) -> Self
pub const fn from_u128(value: u128) -> Self
Creates an instance. Panics if the given value is outside of the valid range
Sourcepub const fn try_new(value: u16) -> Result<Self, TryNewError>
pub const fn try_new(value: u16) -> Result<Self, TryNewError>
Creates an instance or an error if the given value is outside of the valid range
pub const fn extract(value: u16, start_bit: usize) -> Self
Sourcepub const fn extract_u8(value: u8, start_bit: usize) -> Self
pub const fn extract_u8(value: u8, start_bit: usize) -> Self
Extracts bits from a given value. The extract is equivalent to: new((value >> start_bit) & MASK)
Unlike new, extract doesn’t perform range-checking so it is slightly more efficient.
panics if start_bit+
Sourcepub const fn extract_u16(value: u16, start_bit: usize) -> Self
pub const fn extract_u16(value: u16, start_bit: usize) -> Self
Extracts bits from a given value. The extract is equivalent to: new((value >> start_bit) & MASK)
Unlike new, extract doesn’t perform range-checking so it is slightly more efficient
panics if start_bit+
Sourcepub const fn extract_u32(value: u32, start_bit: usize) -> Self
pub const fn extract_u32(value: u32, start_bit: usize) -> Self
Extracts bits from a given value. The extract is equivalent to: new((value >> start_bit) & MASK)
Unlike new, extract doesn’t perform range-checking so it is slightly more efficient
panics if start_bit+
Sourcepub const fn extract_u64(value: u64, start_bit: usize) -> Self
pub const fn extract_u64(value: u64, start_bit: usize) -> Self
Extracts bits from a given value. The extract is equivalent to: new((value >> start_bit) & MASK)
Unlike new, extract doesn’t perform range-checking so it is slightly more efficient
panics if start_bit+
Sourcepub const fn extract_u128(value: u128, start_bit: usize) -> Self
pub const fn extract_u128(value: u128, start_bit: usize) -> Self
Extracts bits from a given value. The extract is equivalent to: new((value >> start_bit) & MASK)
Unlike new, extract doesn’t perform range-checking so it is slightly more efficient
panics if start_bit+
Sourcepub const fn widen<const BITS_RESULT: usize>(self) -> UInt<u16, BITS_RESULT>
pub const fn widen<const BITS_RESULT: usize>(self) -> UInt<u16, BITS_RESULT>
Returns a UInt with a wider bit depth but with the same base data type
pub const fn wrapping_add(self, rhs: Self) -> Self
pub const fn wrapping_sub(self, rhs: Self) -> Self
pub const fn wrapping_mul(self, rhs: Self) -> Self
pub const fn wrapping_div(self, rhs: Self) -> Self
pub const fn wrapping_shl(self, rhs: u32) -> Self
pub const fn wrapping_shr(self, rhs: u32) -> Self
pub const fn saturating_add(self, rhs: Self) -> Self
pub const fn saturating_sub(self, rhs: Self) -> Self
pub const fn saturating_mul(self, rhs: Self) -> Self
pub const fn saturating_div(self, rhs: Self) -> Self
pub const fn saturating_pow(self, exp: u32) -> Self
pub const fn checked_add(self, rhs: Self) -> Option<Self>
pub const fn checked_sub(self, rhs: Self) -> Option<Self>
pub const fn checked_mul(self, rhs: Self) -> Option<Self>
pub const fn checked_div(self, rhs: Self) -> Option<Self>
pub const fn checked_shl(self, rhs: u32) -> Option<Self>
pub const fn checked_shr(self, rhs: u32) -> Option<Self>
pub const fn overflowing_add(self, rhs: Self) -> (Self, bool)
pub const fn overflowing_sub(self, rhs: Self) -> (Self, bool)
pub const fn overflowing_mul(self, rhs: Self) -> (Self, bool)
pub const fn overflowing_div(self, rhs: Self) -> (Self, bool)
pub const fn overflowing_shl(self, rhs: u32) -> (Self, bool)
pub const fn overflowing_shr(self, rhs: u32) -> (Self, bool)
Sourcepub const fn reverse_bits(self) -> Self
pub const fn reverse_bits(self) -> Self
Reverses the order of bits in the integer. The least significant bit becomes the most significant bit, second least-significant bit becomes second most-significant bit, etc.
Sourcepub const fn count_ones(self) -> u32
pub const fn count_ones(self) -> u32
Returns the number of ones in the binary representation of self.
Sourcepub const fn count_zeros(self) -> u32
pub const fn count_zeros(self) -> u32
Returns the number of zeros in the binary representation of self.
Sourcepub const fn leading_ones(self) -> u32
pub const fn leading_ones(self) -> u32
Returns the number of leading ones in the binary representation of self.
Sourcepub const fn leading_zeros(self) -> u32
pub const fn leading_zeros(self) -> u32
Returns the number of leading zeros in the binary representation of self.
Sourcepub const fn trailing_ones(self) -> u32
pub const fn trailing_ones(self) -> u32
Returns the number of leading ones in the binary representation of self.
Sourcepub const fn trailing_zeros(self) -> u32
pub const fn trailing_zeros(self) -> u32
Returns the number of leading zeros in the binary representation of self.
Sourcepub const fn rotate_left(self, n: u32) -> Self
pub const fn rotate_left(self, n: u32) -> Self
Shifts the bits to the left by a specified amount, n, wrapping the truncated bits to the end of the resulting integer. Please note this isn’t the same operation as the << shifting operator!
Sourcepub const fn rotate_right(self, n: u32) -> Self
pub const fn rotate_right(self, n: u32) -> Self
Shifts the bits to the right by a specified amount, n, wrapping the truncated bits to the beginning of the resulting integer. Please note this isn’t the same operation as the >> shifting operator!
Source§impl<const BITS: usize> UInt<u32, BITS>
impl<const BITS: usize> UInt<u32, BITS>
Sourcepub const fn new(value: u32) -> Self
pub const fn new(value: u32) -> Self
Creates an instance. Panics if the given value is outside of the valid range
Sourcepub const fn from_u8(value: u8) -> Self
pub const fn from_u8(value: u8) -> Self
Creates an instance. Panics if the given value is outside of the valid range
Sourcepub const fn from_u16(value: u16) -> Self
pub const fn from_u16(value: u16) -> Self
Creates an instance. Panics if the given value is outside of the valid range
Sourcepub const fn from_u32(value: u32) -> Self
pub const fn from_u32(value: u32) -> Self
Creates an instance. Panics if the given value is outside of the valid range
Sourcepub const fn from_u64(value: u64) -> Self
pub const fn from_u64(value: u64) -> Self
Creates an instance. Panics if the given value is outside of the valid range
Sourcepub const fn from_u128(value: u128) -> Self
pub const fn from_u128(value: u128) -> Self
Creates an instance. Panics if the given value is outside of the valid range
Sourcepub const fn try_new(value: u32) -> Result<Self, TryNewError>
pub const fn try_new(value: u32) -> Result<Self, TryNewError>
Creates an instance or an error if the given value is outside of the valid range
pub const fn extract(value: u32, start_bit: usize) -> Self
Sourcepub const fn extract_u8(value: u8, start_bit: usize) -> Self
pub const fn extract_u8(value: u8, start_bit: usize) -> Self
Extracts bits from a given value. The extract is equivalent to: new((value >> start_bit) & MASK)
Unlike new, extract doesn’t perform range-checking so it is slightly more efficient.
panics if start_bit+
Sourcepub const fn extract_u16(value: u16, start_bit: usize) -> Self
pub const fn extract_u16(value: u16, start_bit: usize) -> Self
Extracts bits from a given value. The extract is equivalent to: new((value >> start_bit) & MASK)
Unlike new, extract doesn’t perform range-checking so it is slightly more efficient
panics if start_bit+
Sourcepub const fn extract_u32(value: u32, start_bit: usize) -> Self
pub const fn extract_u32(value: u32, start_bit: usize) -> Self
Extracts bits from a given value. The extract is equivalent to: new((value >> start_bit) & MASK)
Unlike new, extract doesn’t perform range-checking so it is slightly more efficient
panics if start_bit+
Sourcepub const fn extract_u64(value: u64, start_bit: usize) -> Self
pub const fn extract_u64(value: u64, start_bit: usize) -> Self
Extracts bits from a given value. The extract is equivalent to: new((value >> start_bit) & MASK)
Unlike new, extract doesn’t perform range-checking so it is slightly more efficient
panics if start_bit+
Sourcepub const fn extract_u128(value: u128, start_bit: usize) -> Self
pub const fn extract_u128(value: u128, start_bit: usize) -> Self
Extracts bits from a given value. The extract is equivalent to: new((value >> start_bit) & MASK)
Unlike new, extract doesn’t perform range-checking so it is slightly more efficient
panics if start_bit+
Sourcepub const fn widen<const BITS_RESULT: usize>(self) -> UInt<u32, BITS_RESULT>
pub const fn widen<const BITS_RESULT: usize>(self) -> UInt<u32, BITS_RESULT>
Returns a UInt with a wider bit depth but with the same base data type
pub const fn wrapping_add(self, rhs: Self) -> Self
pub const fn wrapping_sub(self, rhs: Self) -> Self
pub const fn wrapping_mul(self, rhs: Self) -> Self
pub const fn wrapping_div(self, rhs: Self) -> Self
pub const fn wrapping_shl(self, rhs: u32) -> Self
pub const fn wrapping_shr(self, rhs: u32) -> Self
pub const fn saturating_add(self, rhs: Self) -> Self
pub const fn saturating_sub(self, rhs: Self) -> Self
pub const fn saturating_mul(self, rhs: Self) -> Self
pub const fn saturating_div(self, rhs: Self) -> Self
pub const fn saturating_pow(self, exp: u32) -> Self
pub const fn checked_add(self, rhs: Self) -> Option<Self>
pub const fn checked_sub(self, rhs: Self) -> Option<Self>
pub const fn checked_mul(self, rhs: Self) -> Option<Self>
pub const fn checked_div(self, rhs: Self) -> Option<Self>
pub const fn checked_shl(self, rhs: u32) -> Option<Self>
pub const fn checked_shr(self, rhs: u32) -> Option<Self>
pub const fn overflowing_add(self, rhs: Self) -> (Self, bool)
pub const fn overflowing_sub(self, rhs: Self) -> (Self, bool)
pub const fn overflowing_mul(self, rhs: Self) -> (Self, bool)
pub const fn overflowing_div(self, rhs: Self) -> (Self, bool)
pub const fn overflowing_shl(self, rhs: u32) -> (Self, bool)
pub const fn overflowing_shr(self, rhs: u32) -> (Self, bool)
Sourcepub const fn reverse_bits(self) -> Self
pub const fn reverse_bits(self) -> Self
Reverses the order of bits in the integer. The least significant bit becomes the most significant bit, second least-significant bit becomes second most-significant bit, etc.
Sourcepub const fn count_ones(self) -> u32
pub const fn count_ones(self) -> u32
Returns the number of ones in the binary representation of self.
Sourcepub const fn count_zeros(self) -> u32
pub const fn count_zeros(self) -> u32
Returns the number of zeros in the binary representation of self.
Sourcepub const fn leading_ones(self) -> u32
pub const fn leading_ones(self) -> u32
Returns the number of leading ones in the binary representation of self.
Sourcepub const fn leading_zeros(self) -> u32
pub const fn leading_zeros(self) -> u32
Returns the number of leading zeros in the binary representation of self.
Sourcepub const fn trailing_ones(self) -> u32
pub const fn trailing_ones(self) -> u32
Returns the number of leading ones in the binary representation of self.
Sourcepub const fn trailing_zeros(self) -> u32
pub const fn trailing_zeros(self) -> u32
Returns the number of leading zeros in the binary representation of self.
Sourcepub const fn rotate_left(self, n: u32) -> Self
pub const fn rotate_left(self, n: u32) -> Self
Shifts the bits to the left by a specified amount, n, wrapping the truncated bits to the end of the resulting integer. Please note this isn’t the same operation as the << shifting operator!
Sourcepub const fn rotate_right(self, n: u32) -> Self
pub const fn rotate_right(self, n: u32) -> Self
Shifts the bits to the right by a specified amount, n, wrapping the truncated bits to the beginning of the resulting integer. Please note this isn’t the same operation as the >> shifting operator!
Source§impl<const BITS: usize> UInt<u64, BITS>
impl<const BITS: usize> UInt<u64, BITS>
Sourcepub const fn new(value: u64) -> Self
pub const fn new(value: u64) -> Self
Creates an instance. Panics if the given value is outside of the valid range
Sourcepub const fn from_u8(value: u8) -> Self
pub const fn from_u8(value: u8) -> Self
Creates an instance. Panics if the given value is outside of the valid range
Sourcepub const fn from_u16(value: u16) -> Self
pub const fn from_u16(value: u16) -> Self
Creates an instance. Panics if the given value is outside of the valid range
Sourcepub const fn from_u32(value: u32) -> Self
pub const fn from_u32(value: u32) -> Self
Creates an instance. Panics if the given value is outside of the valid range
Sourcepub const fn from_u64(value: u64) -> Self
pub const fn from_u64(value: u64) -> Self
Creates an instance. Panics if the given value is outside of the valid range
Sourcepub const fn from_u128(value: u128) -> Self
pub const fn from_u128(value: u128) -> Self
Creates an instance. Panics if the given value is outside of the valid range
Sourcepub const fn try_new(value: u64) -> Result<Self, TryNewError>
pub const fn try_new(value: u64) -> Result<Self, TryNewError>
Creates an instance or an error if the given value is outside of the valid range
pub const fn extract(value: u64, start_bit: usize) -> Self
Sourcepub const fn extract_u8(value: u8, start_bit: usize) -> Self
pub const fn extract_u8(value: u8, start_bit: usize) -> Self
Extracts bits from a given value. The extract is equivalent to: new((value >> start_bit) & MASK)
Unlike new, extract doesn’t perform range-checking so it is slightly more efficient.
panics if start_bit+
Sourcepub const fn extract_u16(value: u16, start_bit: usize) -> Self
pub const fn extract_u16(value: u16, start_bit: usize) -> Self
Extracts bits from a given value. The extract is equivalent to: new((value >> start_bit) & MASK)
Unlike new, extract doesn’t perform range-checking so it is slightly more efficient
panics if start_bit+
Sourcepub const fn extract_u32(value: u32, start_bit: usize) -> Self
pub const fn extract_u32(value: u32, start_bit: usize) -> Self
Extracts bits from a given value. The extract is equivalent to: new((value >> start_bit) & MASK)
Unlike new, extract doesn’t perform range-checking so it is slightly more efficient
panics if start_bit+
Sourcepub const fn extract_u64(value: u64, start_bit: usize) -> Self
pub const fn extract_u64(value: u64, start_bit: usize) -> Self
Extracts bits from a given value. The extract is equivalent to: new((value >> start_bit) & MASK)
Unlike new, extract doesn’t perform range-checking so it is slightly more efficient
panics if start_bit+
Sourcepub const fn extract_u128(value: u128, start_bit: usize) -> Self
pub const fn extract_u128(value: u128, start_bit: usize) -> Self
Extracts bits from a given value. The extract is equivalent to: new((value >> start_bit) & MASK)
Unlike new, extract doesn’t perform range-checking so it is slightly more efficient
panics if start_bit+
Sourcepub const fn widen<const BITS_RESULT: usize>(self) -> UInt<u64, BITS_RESULT>
pub const fn widen<const BITS_RESULT: usize>(self) -> UInt<u64, BITS_RESULT>
Returns a UInt with a wider bit depth but with the same base data type
pub const fn wrapping_add(self, rhs: Self) -> Self
pub const fn wrapping_sub(self, rhs: Self) -> Self
pub const fn wrapping_mul(self, rhs: Self) -> Self
pub const fn wrapping_div(self, rhs: Self) -> Self
pub const fn wrapping_shl(self, rhs: u32) -> Self
pub const fn wrapping_shr(self, rhs: u32) -> Self
pub const fn saturating_add(self, rhs: Self) -> Self
pub const fn saturating_sub(self, rhs: Self) -> Self
pub const fn saturating_mul(self, rhs: Self) -> Self
pub const fn saturating_div(self, rhs: Self) -> Self
pub const fn saturating_pow(self, exp: u32) -> Self
pub const fn checked_add(self, rhs: Self) -> Option<Self>
pub const fn checked_sub(self, rhs: Self) -> Option<Self>
pub const fn checked_mul(self, rhs: Self) -> Option<Self>
pub const fn checked_div(self, rhs: Self) -> Option<Self>
pub const fn checked_shl(self, rhs: u32) -> Option<Self>
pub const fn checked_shr(self, rhs: u32) -> Option<Self>
pub const fn overflowing_add(self, rhs: Self) -> (Self, bool)
pub const fn overflowing_sub(self, rhs: Self) -> (Self, bool)
pub const fn overflowing_mul(self, rhs: Self) -> (Self, bool)
pub const fn overflowing_div(self, rhs: Self) -> (Self, bool)
pub const fn overflowing_shl(self, rhs: u32) -> (Self, bool)
pub const fn overflowing_shr(self, rhs: u32) -> (Self, bool)
Sourcepub const fn reverse_bits(self) -> Self
pub const fn reverse_bits(self) -> Self
Reverses the order of bits in the integer. The least significant bit becomes the most significant bit, second least-significant bit becomes second most-significant bit, etc.
Sourcepub const fn count_ones(self) -> u32
pub const fn count_ones(self) -> u32
Returns the number of ones in the binary representation of self.
Sourcepub const fn count_zeros(self) -> u32
pub const fn count_zeros(self) -> u32
Returns the number of zeros in the binary representation of self.
Sourcepub const fn leading_ones(self) -> u32
pub const fn leading_ones(self) -> u32
Returns the number of leading ones in the binary representation of self.
Sourcepub const fn leading_zeros(self) -> u32
pub const fn leading_zeros(self) -> u32
Returns the number of leading zeros in the binary representation of self.
Sourcepub const fn trailing_ones(self) -> u32
pub const fn trailing_ones(self) -> u32
Returns the number of leading ones in the binary representation of self.
Sourcepub const fn trailing_zeros(self) -> u32
pub const fn trailing_zeros(self) -> u32
Returns the number of leading zeros in the binary representation of self.
Sourcepub const fn rotate_left(self, n: u32) -> Self
pub const fn rotate_left(self, n: u32) -> Self
Shifts the bits to the left by a specified amount, n, wrapping the truncated bits to the end of the resulting integer. Please note this isn’t the same operation as the << shifting operator!
Sourcepub const fn rotate_right(self, n: u32) -> Self
pub const fn rotate_right(self, n: u32) -> Self
Shifts the bits to the right by a specified amount, n, wrapping the truncated bits to the beginning of the resulting integer. Please note this isn’t the same operation as the >> shifting operator!
Source§impl<const BITS: usize> UInt<u128, BITS>
impl<const BITS: usize> UInt<u128, BITS>
Sourcepub const fn new(value: u128) -> Self
pub const fn new(value: u128) -> Self
Creates an instance. Panics if the given value is outside of the valid range
Sourcepub const fn from_u8(value: u8) -> Self
pub const fn from_u8(value: u8) -> Self
Creates an instance. Panics if the given value is outside of the valid range
Sourcepub const fn from_u16(value: u16) -> Self
pub const fn from_u16(value: u16) -> Self
Creates an instance. Panics if the given value is outside of the valid range
Sourcepub const fn from_u32(value: u32) -> Self
pub const fn from_u32(value: u32) -> Self
Creates an instance. Panics if the given value is outside of the valid range
Sourcepub const fn from_u64(value: u64) -> Self
pub const fn from_u64(value: u64) -> Self
Creates an instance. Panics if the given value is outside of the valid range
Sourcepub const fn from_u128(value: u128) -> Self
pub const fn from_u128(value: u128) -> Self
Creates an instance. Panics if the given value is outside of the valid range
Sourcepub const fn try_new(value: u128) -> Result<Self, TryNewError>
pub const fn try_new(value: u128) -> Result<Self, TryNewError>
Creates an instance or an error if the given value is outside of the valid range
pub const fn extract(value: u128, start_bit: usize) -> Self
Sourcepub const fn extract_u8(value: u8, start_bit: usize) -> Self
pub const fn extract_u8(value: u8, start_bit: usize) -> Self
Extracts bits from a given value. The extract is equivalent to: new((value >> start_bit) & MASK)
Unlike new, extract doesn’t perform range-checking so it is slightly more efficient.
panics if start_bit+
Sourcepub const fn extract_u16(value: u16, start_bit: usize) -> Self
pub const fn extract_u16(value: u16, start_bit: usize) -> Self
Extracts bits from a given value. The extract is equivalent to: new((value >> start_bit) & MASK)
Unlike new, extract doesn’t perform range-checking so it is slightly more efficient
panics if start_bit+
Sourcepub const fn extract_u32(value: u32, start_bit: usize) -> Self
pub const fn extract_u32(value: u32, start_bit: usize) -> Self
Extracts bits from a given value. The extract is equivalent to: new((value >> start_bit) & MASK)
Unlike new, extract doesn’t perform range-checking so it is slightly more efficient
panics if start_bit+
Sourcepub const fn extract_u64(value: u64, start_bit: usize) -> Self
pub const fn extract_u64(value: u64, start_bit: usize) -> Self
Extracts bits from a given value. The extract is equivalent to: new((value >> start_bit) & MASK)
Unlike new, extract doesn’t perform range-checking so it is slightly more efficient
panics if start_bit+
Sourcepub const fn extract_u128(value: u128, start_bit: usize) -> Self
pub const fn extract_u128(value: u128, start_bit: usize) -> Self
Extracts bits from a given value. The extract is equivalent to: new((value >> start_bit) & MASK)
Unlike new, extract doesn’t perform range-checking so it is slightly more efficient
panics if start_bit+
Sourcepub const fn widen<const BITS_RESULT: usize>(self) -> UInt<u128, BITS_RESULT>
pub const fn widen<const BITS_RESULT: usize>(self) -> UInt<u128, BITS_RESULT>
Returns a UInt with a wider bit depth but with the same base data type
pub const fn wrapping_add(self, rhs: Self) -> Self
pub const fn wrapping_sub(self, rhs: Self) -> Self
pub const fn wrapping_mul(self, rhs: Self) -> Self
pub const fn wrapping_div(self, rhs: Self) -> Self
pub const fn wrapping_shl(self, rhs: u32) -> Self
pub const fn wrapping_shr(self, rhs: u32) -> Self
pub const fn saturating_add(self, rhs: Self) -> Self
pub const fn saturating_sub(self, rhs: Self) -> Self
pub const fn saturating_mul(self, rhs: Self) -> Self
pub const fn saturating_div(self, rhs: Self) -> Self
pub const fn saturating_pow(self, exp: u32) -> Self
pub const fn checked_add(self, rhs: Self) -> Option<Self>
pub const fn checked_sub(self, rhs: Self) -> Option<Self>
pub const fn checked_mul(self, rhs: Self) -> Option<Self>
pub const fn checked_div(self, rhs: Self) -> Option<Self>
pub const fn checked_shl(self, rhs: u32) -> Option<Self>
pub const fn checked_shr(self, rhs: u32) -> Option<Self>
pub const fn overflowing_add(self, rhs: Self) -> (Self, bool)
pub const fn overflowing_sub(self, rhs: Self) -> (Self, bool)
pub const fn overflowing_mul(self, rhs: Self) -> (Self, bool)
pub const fn overflowing_div(self, rhs: Self) -> (Self, bool)
pub const fn overflowing_shl(self, rhs: u32) -> (Self, bool)
pub const fn overflowing_shr(self, rhs: u32) -> (Self, bool)
Sourcepub const fn reverse_bits(self) -> Self
pub const fn reverse_bits(self) -> Self
Reverses the order of bits in the integer. The least significant bit becomes the most significant bit, second least-significant bit becomes second most-significant bit, etc.
Sourcepub const fn count_ones(self) -> u32
pub const fn count_ones(self) -> u32
Returns the number of ones in the binary representation of self.
Sourcepub const fn count_zeros(self) -> u32
pub const fn count_zeros(self) -> u32
Returns the number of zeros in the binary representation of self.
Sourcepub const fn leading_ones(self) -> u32
pub const fn leading_ones(self) -> u32
Returns the number of leading ones in the binary representation of self.
Sourcepub const fn leading_zeros(self) -> u32
pub const fn leading_zeros(self) -> u32
Returns the number of leading zeros in the binary representation of self.
Sourcepub const fn trailing_ones(self) -> u32
pub const fn trailing_ones(self) -> u32
Returns the number of leading ones in the binary representation of self.
Sourcepub const fn trailing_zeros(self) -> u32
pub const fn trailing_zeros(self) -> u32
Returns the number of leading zeros in the binary representation of self.
Sourcepub const fn rotate_left(self, n: u32) -> Self
pub const fn rotate_left(self, n: u32) -> Self
Shifts the bits to the left by a specified amount, n, wrapping the truncated bits to the end of the resulting integer. Please note this isn’t the same operation as the << shifting operator!
Sourcepub const fn rotate_right(self, n: u32) -> Self
pub const fn rotate_right(self, n: u32) -> Self
Shifts the bits to the right by a specified amount, n, wrapping the truncated bits to the beginning of the resulting integer. Please note this isn’t the same operation as the >> shifting operator!
Source§impl UInt<u32, 24>
impl UInt<u32, 24>
Sourcepub const fn swap_bytes(&self) -> Self
pub const fn swap_bytes(&self) -> Self
Reverses the byte order of the integer.
pub const fn to_le_bytes(&self) -> [u8; 3]
pub const fn from_le_bytes(from: [u8; 3]) -> Self
pub const fn to_be_bytes(&self) -> [u8; 3]
pub const fn from_be_bytes(from: [u8; 3]) -> Self
pub const fn to_ne_bytes(&self) -> [u8; 3]
pub const fn from_ne_bytes(bytes: [u8; 3]) -> Self
pub const fn to_le(self) -> Self
pub const fn to_be(self) -> Self
pub const fn from_le(value: Self) -> Self
pub const fn from_be(value: Self) -> Self
Source§impl UInt<u64, 24>
impl UInt<u64, 24>
Sourcepub const fn swap_bytes(&self) -> Self
pub const fn swap_bytes(&self) -> Self
Reverses the byte order of the integer.
pub const fn to_le_bytes(&self) -> [u8; 3]
pub const fn from_le_bytes(from: [u8; 3]) -> Self
pub const fn to_be_bytes(&self) -> [u8; 3]
pub const fn from_be_bytes(from: [u8; 3]) -> Self
pub const fn to_ne_bytes(&self) -> [u8; 3]
pub const fn from_ne_bytes(bytes: [u8; 3]) -> Self
pub const fn to_le(self) -> Self
pub const fn to_be(self) -> Self
pub const fn from_le(value: Self) -> Self
pub const fn from_be(value: Self) -> Self
Source§impl UInt<u128, 24>
impl UInt<u128, 24>
Sourcepub const fn swap_bytes(&self) -> Self
pub const fn swap_bytes(&self) -> Self
Reverses the byte order of the integer.
pub const fn to_le_bytes(&self) -> [u8; 3]
pub const fn from_le_bytes(from: [u8; 3]) -> Self
pub const fn to_be_bytes(&self) -> [u8; 3]
pub const fn from_be_bytes(from: [u8; 3]) -> Self
pub const fn to_ne_bytes(&self) -> [u8; 3]
pub const fn from_ne_bytes(bytes: [u8; 3]) -> Self
pub const fn to_le(self) -> Self
pub const fn to_be(self) -> Self
pub const fn from_le(value: Self) -> Self
pub const fn from_be(value: Self) -> Self
Source§impl UInt<u64, 40>
impl UInt<u64, 40>
Sourcepub const fn swap_bytes(&self) -> Self
pub const fn swap_bytes(&self) -> Self
Reverses the byte order of the integer.
pub const fn to_le_bytes(&self) -> [u8; 5]
pub const fn from_le_bytes(from: [u8; 5]) -> Self
pub const fn to_be_bytes(&self) -> [u8; 5]
pub const fn from_be_bytes(from: [u8; 5]) -> Self
pub const fn to_ne_bytes(&self) -> [u8; 5]
pub const fn from_ne_bytes(bytes: [u8; 5]) -> Self
pub const fn to_le(self) -> Self
pub const fn to_be(self) -> Self
pub const fn from_le(value: Self) -> Self
pub const fn from_be(value: Self) -> Self
Source§impl UInt<u128, 40>
impl UInt<u128, 40>
Sourcepub const fn swap_bytes(&self) -> Self
pub const fn swap_bytes(&self) -> Self
Reverses the byte order of the integer.
pub const fn to_le_bytes(&self) -> [u8; 5]
pub const fn from_le_bytes(from: [u8; 5]) -> Self
pub const fn to_be_bytes(&self) -> [u8; 5]
pub const fn from_be_bytes(from: [u8; 5]) -> Self
pub const fn to_ne_bytes(&self) -> [u8; 5]
pub const fn from_ne_bytes(bytes: [u8; 5]) -> Self
pub const fn to_le(self) -> Self
pub const fn to_be(self) -> Self
pub const fn from_le(value: Self) -> Self
pub const fn from_be(value: Self) -> Self
Source§impl UInt<u64, 48>
impl UInt<u64, 48>
Sourcepub const fn swap_bytes(&self) -> Self
pub const fn swap_bytes(&self) -> Self
Reverses the byte order of the integer.
pub const fn to_le_bytes(&self) -> [u8; 6]
pub const fn from_le_bytes(from: [u8; 6]) -> Self
pub const fn to_be_bytes(&self) -> [u8; 6]
pub const fn from_be_bytes(from: [u8; 6]) -> Self
pub const fn to_ne_bytes(&self) -> [u8; 6]
pub const fn from_ne_bytes(bytes: [u8; 6]) -> Self
pub const fn to_le(self) -> Self
pub const fn to_be(self) -> Self
pub const fn from_le(value: Self) -> Self
pub const fn from_be(value: Self) -> Self
Source§impl UInt<u128, 48>
impl UInt<u128, 48>
Sourcepub const fn swap_bytes(&self) -> Self
pub const fn swap_bytes(&self) -> Self
Reverses the byte order of the integer.
pub const fn to_le_bytes(&self) -> [u8; 6]
pub const fn from_le_bytes(from: [u8; 6]) -> Self
pub const fn to_be_bytes(&self) -> [u8; 6]
pub const fn from_be_bytes(from: [u8; 6]) -> Self
pub const fn to_ne_bytes(&self) -> [u8; 6]
pub const fn from_ne_bytes(bytes: [u8; 6]) -> Self
pub const fn to_le(self) -> Self
pub const fn to_be(self) -> Self
pub const fn from_le(value: Self) -> Self
pub const fn from_be(value: Self) -> Self
Source§impl UInt<u64, 56>
impl UInt<u64, 56>
Sourcepub const fn swap_bytes(&self) -> Self
pub const fn swap_bytes(&self) -> Self
Reverses the byte order of the integer.
pub const fn to_le_bytes(&self) -> [u8; 7]
pub const fn from_le_bytes(from: [u8; 7]) -> Self
pub const fn to_be_bytes(&self) -> [u8; 7]
pub const fn from_be_bytes(from: [u8; 7]) -> Self
pub const fn to_ne_bytes(&self) -> [u8; 7]
pub const fn from_ne_bytes(bytes: [u8; 7]) -> Self
pub const fn to_le(self) -> Self
pub const fn to_be(self) -> Self
pub const fn from_le(value: Self) -> Self
pub const fn from_be(value: Self) -> Self
Source§impl UInt<u128, 56>
impl UInt<u128, 56>
Sourcepub const fn swap_bytes(&self) -> Self
pub const fn swap_bytes(&self) -> Self
Reverses the byte order of the integer.
pub const fn to_le_bytes(&self) -> [u8; 7]
pub const fn from_le_bytes(from: [u8; 7]) -> Self
pub const fn to_be_bytes(&self) -> [u8; 7]
pub const fn from_be_bytes(from: [u8; 7]) -> Self
pub const fn to_ne_bytes(&self) -> [u8; 7]
pub const fn from_ne_bytes(bytes: [u8; 7]) -> Self
pub const fn to_le(self) -> Self
pub const fn to_be(self) -> Self
pub const fn from_le(value: Self) -> Self
pub const fn from_be(value: Self) -> Self
Source§impl UInt<u128, 72>
impl UInt<u128, 72>
Sourcepub const fn swap_bytes(&self) -> Self
pub const fn swap_bytes(&self) -> Self
Reverses the byte order of the integer.
pub const fn to_le_bytes(&self) -> [u8; 9]
pub const fn from_le_bytes(from: [u8; 9]) -> Self
pub const fn to_be_bytes(&self) -> [u8; 9]
pub const fn from_be_bytes(from: [u8; 9]) -> Self
pub const fn to_ne_bytes(&self) -> [u8; 9]
pub const fn from_ne_bytes(bytes: [u8; 9]) -> Self
pub const fn to_le(self) -> Self
pub const fn to_be(self) -> Self
pub const fn from_le(value: Self) -> Self
pub const fn from_be(value: Self) -> Self
Source§impl UInt<u128, 80>
impl UInt<u128, 80>
Sourcepub const fn swap_bytes(&self) -> Self
pub const fn swap_bytes(&self) -> Self
Reverses the byte order of the integer.
pub const fn to_le_bytes(&self) -> [u8; 10]
pub const fn from_le_bytes(from: [u8; 10]) -> Self
pub const fn to_be_bytes(&self) -> [u8; 10]
pub const fn from_be_bytes(from: [u8; 10]) -> Self
pub const fn to_ne_bytes(&self) -> [u8; 10]
pub const fn from_ne_bytes(bytes: [u8; 10]) -> Self
pub const fn to_le(self) -> Self
pub const fn to_be(self) -> Self
pub const fn from_le(value: Self) -> Self
pub const fn from_be(value: Self) -> Self
Source§impl UInt<u128, 88>
impl UInt<u128, 88>
Sourcepub const fn swap_bytes(&self) -> Self
pub const fn swap_bytes(&self) -> Self
Reverses the byte order of the integer.
pub const fn to_le_bytes(&self) -> [u8; 11]
pub const fn from_le_bytes(from: [u8; 11]) -> Self
pub const fn to_be_bytes(&self) -> [u8; 11]
pub const fn from_be_bytes(from: [u8; 11]) -> Self
pub const fn to_ne_bytes(&self) -> [u8; 11]
pub const fn from_ne_bytes(bytes: [u8; 11]) -> Self
pub const fn to_le(self) -> Self
pub const fn to_be(self) -> Self
pub const fn from_le(value: Self) -> Self
pub const fn from_be(value: Self) -> Self
Source§impl UInt<u128, 96>
impl UInt<u128, 96>
Sourcepub const fn swap_bytes(&self) -> Self
pub const fn swap_bytes(&self) -> Self
Reverses the byte order of the integer.
pub const fn to_le_bytes(&self) -> [u8; 12]
pub const fn from_le_bytes(from: [u8; 12]) -> Self
pub const fn to_be_bytes(&self) -> [u8; 12]
pub const fn from_be_bytes(from: [u8; 12]) -> Self
pub const fn to_ne_bytes(&self) -> [u8; 12]
pub const fn from_ne_bytes(bytes: [u8; 12]) -> Self
pub const fn to_le(self) -> Self
pub const fn to_be(self) -> Self
pub const fn from_le(value: Self) -> Self
pub const fn from_be(value: Self) -> Self
Source§impl UInt<u128, 104>
impl UInt<u128, 104>
Sourcepub const fn swap_bytes(&self) -> Self
pub const fn swap_bytes(&self) -> Self
Reverses the byte order of the integer.
pub const fn to_le_bytes(&self) -> [u8; 13]
pub const fn from_le_bytes(from: [u8; 13]) -> Self
pub const fn to_be_bytes(&self) -> [u8; 13]
pub const fn from_be_bytes(from: [u8; 13]) -> Self
pub const fn to_ne_bytes(&self) -> [u8; 13]
pub const fn from_ne_bytes(bytes: [u8; 13]) -> Self
pub const fn to_le(self) -> Self
pub const fn to_be(self) -> Self
pub const fn from_le(value: Self) -> Self
pub const fn from_be(value: Self) -> Self
Source§impl UInt<u128, 112>
impl UInt<u128, 112>
Sourcepub const fn swap_bytes(&self) -> Self
pub const fn swap_bytes(&self) -> Self
Reverses the byte order of the integer.
pub const fn to_le_bytes(&self) -> [u8; 14]
pub const fn from_le_bytes(from: [u8; 14]) -> Self
pub const fn to_be_bytes(&self) -> [u8; 14]
pub const fn from_be_bytes(from: [u8; 14]) -> Self
pub const fn to_ne_bytes(&self) -> [u8; 14]
pub const fn from_ne_bytes(bytes: [u8; 14]) -> Self
pub const fn to_le(self) -> Self
pub const fn to_be(self) -> Self
pub const fn from_le(value: Self) -> Self
pub const fn from_be(value: Self) -> Self
Source§impl UInt<u128, 120>
impl UInt<u128, 120>
Sourcepub const fn swap_bytes(&self) -> Self
pub const fn swap_bytes(&self) -> Self
Reverses the byte order of the integer.
pub const fn to_le_bytes(&self) -> [u8; 15]
pub const fn from_le_bytes(from: [u8; 15]) -> Self
pub const fn to_be_bytes(&self) -> [u8; 15]
pub const fn from_be_bytes(from: [u8; 15]) -> Self
pub const fn to_ne_bytes(&self) -> [u8; 15]
pub const fn from_ne_bytes(bytes: [u8; 15]) -> Self
pub const fn to_le(self) -> Self
pub const fn to_be(self) -> Self
pub const fn from_le(value: Self) -> Self
pub const fn from_be(value: Self) -> Self
Trait Implementations§
Source§impl<T, const BITS: usize> AddAssign for UInt<T, BITS>
impl<T, const BITS: usize> AddAssign for UInt<T, BITS>
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
+= operation. Read moreSource§impl<T, const BITS: usize> BitAndAssign for UInt<T, BITS>
impl<T, const BITS: usize> BitAndAssign for UInt<T, BITS>
Source§fn bitand_assign(&mut self, rhs: Self)
fn bitand_assign(&mut self, rhs: Self)
&= operation. Read moreSource§impl<T, const BITS: usize> BitOrAssign for UInt<T, BITS>
impl<T, const BITS: usize> BitOrAssign for UInt<T, BITS>
Source§fn bitor_assign(&mut self, rhs: Self)
fn bitor_assign(&mut self, rhs: Self)
|= operation. Read moreSource§impl<T, const BITS: usize> BitXorAssign for UInt<T, BITS>
impl<T, const BITS: usize> BitXorAssign for UInt<T, BITS>
Source§fn bitxor_assign(&mut self, rhs: Self)
fn bitxor_assign(&mut self, rhs: Self)
^= operation. Read moreSource§impl<T, const BITS: usize> DivAssign for UInt<T, BITS>
impl<T, const BITS: usize> DivAssign for UInt<T, BITS>
Source§fn div_assign(&mut self, rhs: Self)
fn div_assign(&mut self, rhs: Self)
/= operation. Read moreSource§impl<const BITS: usize, const BITS_FROM: usize> From<UInt<u128, BITS_FROM>> for UInt<u16, BITS>
impl<const BITS: usize, const BITS_FROM: usize> From<UInt<u128, BITS_FROM>> for UInt<u16, BITS>
Source§impl<const BITS: usize, const BITS_FROM: usize> From<UInt<u128, BITS_FROM>> for UInt<u32, BITS>
impl<const BITS: usize, const BITS_FROM: usize> From<UInt<u128, BITS_FROM>> for UInt<u32, BITS>
Source§impl<const BITS: usize, const BITS_FROM: usize> From<UInt<u128, BITS_FROM>> for UInt<u64, BITS>
impl<const BITS: usize, const BITS_FROM: usize> From<UInt<u128, BITS_FROM>> for UInt<u64, BITS>
Source§impl<const BITS: usize, const BITS_FROM: usize> From<UInt<u128, BITS_FROM>> for UInt<u8, BITS>
impl<const BITS: usize, const BITS_FROM: usize> From<UInt<u128, BITS_FROM>> for UInt<u8, BITS>
Source§impl<const BITS: usize, const BITS_FROM: usize> From<UInt<u16, BITS_FROM>> for UInt<u128, BITS>
impl<const BITS: usize, const BITS_FROM: usize> From<UInt<u16, BITS_FROM>> for UInt<u128, BITS>
Source§impl<const BITS: usize, const BITS_FROM: usize> From<UInt<u16, BITS_FROM>> for UInt<u32, BITS>
impl<const BITS: usize, const BITS_FROM: usize> From<UInt<u16, BITS_FROM>> for UInt<u32, BITS>
Source§impl<const BITS: usize, const BITS_FROM: usize> From<UInt<u16, BITS_FROM>> for UInt<u64, BITS>
impl<const BITS: usize, const BITS_FROM: usize> From<UInt<u16, BITS_FROM>> for UInt<u64, BITS>
Source§impl<const BITS: usize, const BITS_FROM: usize> From<UInt<u16, BITS_FROM>> for UInt<u8, BITS>
impl<const BITS: usize, const BITS_FROM: usize> From<UInt<u16, BITS_FROM>> for UInt<u8, BITS>
Source§impl<const BITS: usize, const BITS_FROM: usize> From<UInt<u32, BITS_FROM>> for UInt<u128, BITS>
impl<const BITS: usize, const BITS_FROM: usize> From<UInt<u32, BITS_FROM>> for UInt<u128, BITS>
Source§impl<const BITS: usize, const BITS_FROM: usize> From<UInt<u32, BITS_FROM>> for UInt<u16, BITS>
impl<const BITS: usize, const BITS_FROM: usize> From<UInt<u32, BITS_FROM>> for UInt<u16, BITS>
Source§impl<const BITS: usize, const BITS_FROM: usize> From<UInt<u32, BITS_FROM>> for UInt<u64, BITS>
impl<const BITS: usize, const BITS_FROM: usize> From<UInt<u32, BITS_FROM>> for UInt<u64, BITS>
Source§impl<const BITS: usize, const BITS_FROM: usize> From<UInt<u32, BITS_FROM>> for UInt<u8, BITS>
impl<const BITS: usize, const BITS_FROM: usize> From<UInt<u32, BITS_FROM>> for UInt<u8, BITS>
Source§impl<const BITS: usize, const BITS_FROM: usize> From<UInt<u64, BITS_FROM>> for UInt<u128, BITS>
impl<const BITS: usize, const BITS_FROM: usize> From<UInt<u64, BITS_FROM>> for UInt<u128, BITS>
Source§impl<const BITS: usize, const BITS_FROM: usize> From<UInt<u64, BITS_FROM>> for UInt<u16, BITS>
impl<const BITS: usize, const BITS_FROM: usize> From<UInt<u64, BITS_FROM>> for UInt<u16, BITS>
Source§impl<const BITS: usize, const BITS_FROM: usize> From<UInt<u64, BITS_FROM>> for UInt<u32, BITS>
impl<const BITS: usize, const BITS_FROM: usize> From<UInt<u64, BITS_FROM>> for UInt<u32, BITS>
Source§impl<const BITS: usize, const BITS_FROM: usize> From<UInt<u64, BITS_FROM>> for UInt<u8, BITS>
impl<const BITS: usize, const BITS_FROM: usize> From<UInt<u64, BITS_FROM>> for UInt<u8, BITS>
Source§impl<const BITS: usize, const BITS_FROM: usize> From<UInt<u8, BITS_FROM>> for UInt<u128, BITS>
impl<const BITS: usize, const BITS_FROM: usize> From<UInt<u8, BITS_FROM>> for UInt<u128, BITS>
Source§impl<const BITS: usize, const BITS_FROM: usize> From<UInt<u8, BITS_FROM>> for UInt<u16, BITS>
impl<const BITS: usize, const BITS_FROM: usize> From<UInt<u8, BITS_FROM>> for UInt<u16, BITS>
Source§impl<const BITS: usize, const BITS_FROM: usize> From<UInt<u8, BITS_FROM>> for UInt<u32, BITS>
impl<const BITS: usize, const BITS_FROM: usize> From<UInt<u8, BITS_FROM>> for UInt<u32, BITS>
Source§impl<const BITS: usize, const BITS_FROM: usize> From<UInt<u8, BITS_FROM>> for UInt<u64, BITS>
impl<const BITS: usize, const BITS_FROM: usize> From<UInt<u8, BITS_FROM>> for UInt<u64, BITS>
Source§impl<T, const BITS: usize> MulAssign for UInt<T, BITS>
impl<T, const BITS: usize> MulAssign for UInt<T, BITS>
Source§fn mul_assign(&mut self, rhs: Self)
fn mul_assign(&mut self, rhs: Self)
*= operation. Read moreSource§impl<const BITS: usize> Number for UInt<u128, BITS>
impl<const BITS: usize> Number for UInt<u128, BITS>
type UnderlyingType = u128
Source§fn try_new(value: Self::UnderlyingType) -> Result<Self, TryNewError>
fn try_new(value: Self::UnderlyingType) -> Result<Self, TryNewError>
Source§fn new(value: u128) -> Self
fn new(value: u128) -> Self
Source§fn from_<T: Number>(value: T) -> Self
fn from_<T: Number>(value: T) -> Self
Self::new for literals.Source§fn masked_new<T: Number>(value: T) -> Self
fn masked_new<T: Number>(value: T) -> Self
value. Unlike the various new... functions, this
will never fail as the value is masked to the result size.fn as_u8(&self) -> u8
fn as_u16(&self) -> u16
fn as_u32(&self) -> u32
fn as_u64(&self) -> u64
fn as_u128(&self) -> u128
fn as_usize(&self) -> usize
fn value(self) -> u128
fn as_<T: Number>(self) -> T
Source§impl<const BITS: usize> Number for UInt<u16, BITS>
impl<const BITS: usize> Number for UInt<u16, BITS>
type UnderlyingType = u16
Source§fn try_new(value: Self::UnderlyingType) -> Result<Self, TryNewError>
fn try_new(value: Self::UnderlyingType) -> Result<Self, TryNewError>
Source§fn new(value: u16) -> Self
fn new(value: u16) -> Self
Source§fn from_<T: Number>(value: T) -> Self
fn from_<T: Number>(value: T) -> Self
Self::new for literals.Source§fn masked_new<T: Number>(value: T) -> Self
fn masked_new<T: Number>(value: T) -> Self
value. Unlike the various new... functions, this
will never fail as the value is masked to the result size.fn as_u8(&self) -> u8
fn as_u16(&self) -> u16
fn as_u32(&self) -> u32
fn as_u64(&self) -> u64
fn as_u128(&self) -> u128
fn as_usize(&self) -> usize
fn value(self) -> u16
fn as_<T: Number>(self) -> T
Source§impl<const BITS: usize> Number for UInt<u32, BITS>
impl<const BITS: usize> Number for UInt<u32, BITS>
type UnderlyingType = u32
Source§fn try_new(value: Self::UnderlyingType) -> Result<Self, TryNewError>
fn try_new(value: Self::UnderlyingType) -> Result<Self, TryNewError>
Source§fn new(value: u32) -> Self
fn new(value: u32) -> Self
Source§fn from_<T: Number>(value: T) -> Self
fn from_<T: Number>(value: T) -> Self
Self::new for literals.Source§fn masked_new<T: Number>(value: T) -> Self
fn masked_new<T: Number>(value: T) -> Self
value. Unlike the various new... functions, this
will never fail as the value is masked to the result size.fn as_u8(&self) -> u8
fn as_u16(&self) -> u16
fn as_u32(&self) -> u32
fn as_u64(&self) -> u64
fn as_u128(&self) -> u128
fn as_usize(&self) -> usize
fn value(self) -> u32
fn as_<T: Number>(self) -> T
Source§impl<const BITS: usize> Number for UInt<u64, BITS>
impl<const BITS: usize> Number for UInt<u64, BITS>
type UnderlyingType = u64
Source§fn try_new(value: Self::UnderlyingType) -> Result<Self, TryNewError>
fn try_new(value: Self::UnderlyingType) -> Result<Self, TryNewError>
Source§fn new(value: u64) -> Self
fn new(value: u64) -> Self
Source§fn from_<T: Number>(value: T) -> Self
fn from_<T: Number>(value: T) -> Self
Self::new for literals.Source§fn masked_new<T: Number>(value: T) -> Self
fn masked_new<T: Number>(value: T) -> Self
value. Unlike the various new... functions, this
will never fail as the value is masked to the result size.fn as_u8(&self) -> u8
fn as_u16(&self) -> u16
fn as_u32(&self) -> u32
fn as_u64(&self) -> u64
fn as_u128(&self) -> u128
fn as_usize(&self) -> usize
fn value(self) -> u64
fn as_<T: Number>(self) -> T
Source§impl<const BITS: usize> Number for UInt<u8, BITS>
impl<const BITS: usize> Number for UInt<u8, BITS>
type UnderlyingType = u8
Source§fn try_new(value: Self::UnderlyingType) -> Result<Self, TryNewError>
fn try_new(value: Self::UnderlyingType) -> Result<Self, TryNewError>
Source§fn new(value: u8) -> Self
fn new(value: u8) -> Self
Source§fn from_<T: Number>(value: T) -> Self
fn from_<T: Number>(value: T) -> Self
Self::new for literals.Source§fn masked_new<T: Number>(value: T) -> Self
fn masked_new<T: Number>(value: T) -> Self
value. Unlike the various new... functions, this
will never fail as the value is masked to the result size.fn as_u8(&self) -> u8
fn as_u16(&self) -> u16
fn as_u32(&self) -> u32
fn as_u64(&self) -> u64
fn as_u128(&self) -> u128
fn as_usize(&self) -> usize
fn value(self) -> u8
fn as_<T: Number>(self) -> T
Source§impl<T: Ord, const BITS: usize> Ord for UInt<T, BITS>
impl<T: Ord, const BITS: usize> Ord for UInt<T, BITS>
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl<T: PartialOrd, const BITS: usize> PartialOrd for UInt<T, BITS>
impl<T: PartialOrd, const BITS: usize> PartialOrd for UInt<T, BITS>
Source§impl<T, TSHIFTBITS, const BITS: usize> ShlAssign<TSHIFTBITS> for UInt<T, BITS>
impl<T, TSHIFTBITS, const BITS: usize> ShlAssign<TSHIFTBITS> for UInt<T, BITS>
Source§fn shl_assign(&mut self, rhs: TSHIFTBITS)
fn shl_assign(&mut self, rhs: TSHIFTBITS)
<<= operation. Read moreSource§impl<T, TSHIFTBITS, const BITS: usize> ShrAssign<TSHIFTBITS> for UInt<T, BITS>
impl<T, TSHIFTBITS, const BITS: usize> ShrAssign<TSHIFTBITS> for UInt<T, BITS>
Source§fn shr_assign(&mut self, rhs: TSHIFTBITS)
fn shr_assign(&mut self, rhs: TSHIFTBITS)
>>= operation. Read moreSource§impl<T, const BITS: usize> SubAssign for UInt<T, BITS>
impl<T, const BITS: usize> SubAssign for UInt<T, BITS>
Source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
-= operation. Read more