Struct arbitrary_int::UInt

source ·
pub struct UInt<T, const BITS: usize> { /* private fields */ }

Implementations§

source§

impl<T: Copy, const BITS: usize> UInt<T, BITS>

source

pub const BITS: usize = BITS

source

pub const fn value(self) -> T

Returns the type as a fundamental data type

source

pub const unsafe fn new_unchecked(value: T) -> Self

Initializes a new value without checking the bounds

Safety

Must only be called with a value less than or equal to Self::MAX value.

source§

impl<T, const BITS: usize> UInt<T, BITS>where Self: Number, T: Copy,

source

pub const MASK: T = _

source§

impl<const BITS: usize> UInt<u8, BITS>

source

pub const fn new(value: u8) -> Self

Creates an instance. Panics if the given value is outside of the valid range

source

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

source

pub const fn extract(value: u8, start_bit: usize) -> Self

👎Deprecated: Use one of the specific functions like extract_u32
source

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+ doesn’t fit within an u8, e.g. u5::extract_u8(8, 4);

source

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+ doesn’t fit within a u16, e.g. u15::extract_u16(8, 2);

source

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+ doesn’t fit within a u32, e.g. u30::extract_u32(8, 4);

source

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+ doesn’t fit within a u64, e.g. u60::extract_u64(8, 5);

source

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+ doesn’t fit within a u128, e.g. u120::extract_u64(8, 9);

source

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

source

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.

source

pub const fn count_ones(self) -> u32

Returns the number of ones in the binary representation of self.

source

pub const fn count_zeros(self) -> u32

Returns the number of zeros in the binary representation of self.

source

pub const fn leading_ones(self) -> u32

Returns the number of leading ones in the binary representation of self.

source

pub const fn leading_zeros(self) -> u32

Returns the number of leading zeros in the binary representation of self.

source

pub const fn trailing_ones(self) -> u32

Returns the number of leading ones in the binary representation of self.

source

pub const fn trailing_zeros(self) -> u32

Returns the number of leading zeros in the binary representation of self.

source

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!

source

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>

source

pub const fn new(value: u16) -> Self

Creates an instance. Panics if the given value is outside of the valid range

source

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

source

pub const fn extract(value: u16, start_bit: usize) -> Self

👎Deprecated: Use one of the specific functions like extract_u32
source

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+ doesn’t fit within an u8, e.g. u5::extract_u8(8, 4);

source

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+ doesn’t fit within a u16, e.g. u15::extract_u16(8, 2);

source

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+ doesn’t fit within a u32, e.g. u30::extract_u32(8, 4);

source

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+ doesn’t fit within a u64, e.g. u60::extract_u64(8, 5);

source

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+ doesn’t fit within a u128, e.g. u120::extract_u64(8, 9);

source

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

source

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.

source

pub const fn count_ones(self) -> u32

Returns the number of ones in the binary representation of self.

source

pub const fn count_zeros(self) -> u32

Returns the number of zeros in the binary representation of self.

source

pub const fn leading_ones(self) -> u32

Returns the number of leading ones in the binary representation of self.

source

pub const fn leading_zeros(self) -> u32

Returns the number of leading zeros in the binary representation of self.

source

pub const fn trailing_ones(self) -> u32

Returns the number of leading ones in the binary representation of self.

source

pub const fn trailing_zeros(self) -> u32

Returns the number of leading zeros in the binary representation of self.

source

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!

source

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>

source

pub const fn new(value: u32) -> Self

Creates an instance. Panics if the given value is outside of the valid range

source

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

source

pub const fn extract(value: u32, start_bit: usize) -> Self

👎Deprecated: Use one of the specific functions like extract_u32
source

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+ doesn’t fit within an u8, e.g. u5::extract_u8(8, 4);

source

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+ doesn’t fit within a u16, e.g. u15::extract_u16(8, 2);

source

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+ doesn’t fit within a u32, e.g. u30::extract_u32(8, 4);

source

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+ doesn’t fit within a u64, e.g. u60::extract_u64(8, 5);

source

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+ doesn’t fit within a u128, e.g. u120::extract_u64(8, 9);

source

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

source

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.

source

pub const fn count_ones(self) -> u32

Returns the number of ones in the binary representation of self.

source

pub const fn count_zeros(self) -> u32

Returns the number of zeros in the binary representation of self.

source

pub const fn leading_ones(self) -> u32

Returns the number of leading ones in the binary representation of self.

source

pub const fn leading_zeros(self) -> u32

Returns the number of leading zeros in the binary representation of self.

source

pub const fn trailing_ones(self) -> u32

Returns the number of leading ones in the binary representation of self.

source

pub const fn trailing_zeros(self) -> u32

Returns the number of leading zeros in the binary representation of self.

source

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!

source

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>

source

pub const fn new(value: u64) -> Self

Creates an instance. Panics if the given value is outside of the valid range

source

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

source

pub const fn extract(value: u64, start_bit: usize) -> Self

👎Deprecated: Use one of the specific functions like extract_u32
source

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+ doesn’t fit within an u8, e.g. u5::extract_u8(8, 4);

source

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+ doesn’t fit within a u16, e.g. u15::extract_u16(8, 2);

source

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+ doesn’t fit within a u32, e.g. u30::extract_u32(8, 4);

source

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+ doesn’t fit within a u64, e.g. u60::extract_u64(8, 5);

source

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+ doesn’t fit within a u128, e.g. u120::extract_u64(8, 9);

source

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

source

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.

source

pub const fn count_ones(self) -> u32

Returns the number of ones in the binary representation of self.

source

pub const fn count_zeros(self) -> u32

Returns the number of zeros in the binary representation of self.

source

pub const fn leading_ones(self) -> u32

Returns the number of leading ones in the binary representation of self.

source

pub const fn leading_zeros(self) -> u32

Returns the number of leading zeros in the binary representation of self.

source

pub const fn trailing_ones(self) -> u32

Returns the number of leading ones in the binary representation of self.

source

pub const fn trailing_zeros(self) -> u32

Returns the number of leading zeros in the binary representation of self.

source

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!

source

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>

source

pub const fn new(value: u128) -> Self

Creates an instance. Panics if the given value is outside of the valid range

source

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

source

pub const fn extract(value: u128, start_bit: usize) -> Self

👎Deprecated: Use one of the specific functions like extract_u32
source

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+ doesn’t fit within an u8, e.g. u5::extract_u8(8, 4);

source

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+ doesn’t fit within a u16, e.g. u15::extract_u16(8, 2);

source

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+ doesn’t fit within a u32, e.g. u30::extract_u32(8, 4);

source

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+ doesn’t fit within a u64, e.g. u60::extract_u64(8, 5);

source

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+ doesn’t fit within a u128, e.g. u120::extract_u64(8, 9);

source

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

source

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.

source

pub const fn count_ones(self) -> u32

Returns the number of ones in the binary representation of self.

source

pub const fn count_zeros(self) -> u32

Returns the number of zeros in the binary representation of self.

source

pub const fn leading_ones(self) -> u32

Returns the number of leading ones in the binary representation of self.

source

pub const fn leading_zeros(self) -> u32

Returns the number of leading zeros in the binary representation of self.

source

pub const fn trailing_ones(self) -> u32

Returns the number of leading ones in the binary representation of self.

source

pub const fn trailing_zeros(self) -> u32

Returns the number of leading zeros in the binary representation of self.

source

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!

source

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>

source

pub const fn swap_bytes(&self) -> Self

Reverses the byte order of the integer.

source

pub const fn to_le_bytes(&self) -> [u8; 3]

source

pub const fn from_le_bytes(from: [u8; 3]) -> Self

source

pub const fn to_be_bytes(&self) -> [u8; 3]

source

pub const fn from_be_bytes(from: [u8; 3]) -> Self

source

pub const fn to_ne_bytes(&self) -> [u8; 3]

source

pub const fn from_ne_bytes(bytes: [u8; 3]) -> Self

source

pub const fn to_le(self) -> Self

source

pub const fn to_be(self) -> Self

source

pub const fn from_le(value: Self) -> Self

source

pub const fn from_be(value: Self) -> Self

source§

impl UInt<u64, 24>

source

pub const fn swap_bytes(&self) -> Self

Reverses the byte order of the integer.

source

pub const fn to_le_bytes(&self) -> [u8; 3]

source

pub const fn from_le_bytes(from: [u8; 3]) -> Self

source

pub const fn to_be_bytes(&self) -> [u8; 3]

source

pub const fn from_be_bytes(from: [u8; 3]) -> Self

source

pub const fn to_ne_bytes(&self) -> [u8; 3]

source

pub const fn from_ne_bytes(bytes: [u8; 3]) -> Self

source

pub const fn to_le(self) -> Self

source

pub const fn to_be(self) -> Self

source

pub const fn from_le(value: Self) -> Self

source

pub const fn from_be(value: Self) -> Self

source§

impl UInt<u128, 24>

source

pub const fn swap_bytes(&self) -> Self

Reverses the byte order of the integer.

source

pub const fn to_le_bytes(&self) -> [u8; 3]

source

pub const fn from_le_bytes(from: [u8; 3]) -> Self

source

pub const fn to_be_bytes(&self) -> [u8; 3]

source

pub const fn from_be_bytes(from: [u8; 3]) -> Self

source

pub const fn to_ne_bytes(&self) -> [u8; 3]

source

pub const fn from_ne_bytes(bytes: [u8; 3]) -> Self

source

pub const fn to_le(self) -> Self

source

pub const fn to_be(self) -> Self

source

pub const fn from_le(value: Self) -> Self

source

pub const fn from_be(value: Self) -> Self

source§

impl UInt<u64, 40>

source

pub const fn swap_bytes(&self) -> Self

Reverses the byte order of the integer.

source

pub const fn to_le_bytes(&self) -> [u8; 5]

source

pub const fn from_le_bytes(from: [u8; 5]) -> Self

source

pub const fn to_be_bytes(&self) -> [u8; 5]

source

pub const fn from_be_bytes(from: [u8; 5]) -> Self

source

pub const fn to_ne_bytes(&self) -> [u8; 5]

source

pub const fn from_ne_bytes(bytes: [u8; 5]) -> Self

source

pub const fn to_le(self) -> Self

source

pub const fn to_be(self) -> Self

source

pub const fn from_le(value: Self) -> Self

source

pub const fn from_be(value: Self) -> Self

source§

impl UInt<u128, 40>

source

pub const fn swap_bytes(&self) -> Self

Reverses the byte order of the integer.

source

pub const fn to_le_bytes(&self) -> [u8; 5]

source

pub const fn from_le_bytes(from: [u8; 5]) -> Self

source

pub const fn to_be_bytes(&self) -> [u8; 5]

source

pub const fn from_be_bytes(from: [u8; 5]) -> Self

source

pub const fn to_ne_bytes(&self) -> [u8; 5]

source

pub const fn from_ne_bytes(bytes: [u8; 5]) -> Self

source

pub const fn to_le(self) -> Self

source

pub const fn to_be(self) -> Self

source

pub const fn from_le(value: Self) -> Self

source

pub const fn from_be(value: Self) -> Self

source§

impl UInt<u64, 48>

source

pub const fn swap_bytes(&self) -> Self

Reverses the byte order of the integer.

source

pub const fn to_le_bytes(&self) -> [u8; 6]

source

pub const fn from_le_bytes(from: [u8; 6]) -> Self

source

pub const fn to_be_bytes(&self) -> [u8; 6]

source

pub const fn from_be_bytes(from: [u8; 6]) -> Self

source

pub const fn to_ne_bytes(&self) -> [u8; 6]

source

pub const fn from_ne_bytes(bytes: [u8; 6]) -> Self

source

pub const fn to_le(self) -> Self

source

pub const fn to_be(self) -> Self

source

pub const fn from_le(value: Self) -> Self

source

pub const fn from_be(value: Self) -> Self

source§

impl UInt<u128, 48>

source

pub const fn swap_bytes(&self) -> Self

Reverses the byte order of the integer.

source

pub const fn to_le_bytes(&self) -> [u8; 6]

source

pub const fn from_le_bytes(from: [u8; 6]) -> Self

source

pub const fn to_be_bytes(&self) -> [u8; 6]

source

pub const fn from_be_bytes(from: [u8; 6]) -> Self

source

pub const fn to_ne_bytes(&self) -> [u8; 6]

source

pub const fn from_ne_bytes(bytes: [u8; 6]) -> Self

source

pub const fn to_le(self) -> Self

source

pub const fn to_be(self) -> Self

source

pub const fn from_le(value: Self) -> Self

source

pub const fn from_be(value: Self) -> Self

source§

impl UInt<u64, 56>

source

pub const fn swap_bytes(&self) -> Self

Reverses the byte order of the integer.

source

pub const fn to_le_bytes(&self) -> [u8; 7]

source

pub const fn from_le_bytes(from: [u8; 7]) -> Self

source

pub const fn to_be_bytes(&self) -> [u8; 7]

source

pub const fn from_be_bytes(from: [u8; 7]) -> Self

source

pub const fn to_ne_bytes(&self) -> [u8; 7]

source

pub const fn from_ne_bytes(bytes: [u8; 7]) -> Self

source

pub const fn to_le(self) -> Self

source

pub const fn to_be(self) -> Self

source

pub const fn from_le(value: Self) -> Self

source

pub const fn from_be(value: Self) -> Self

source§

impl UInt<u128, 56>

source

pub const fn swap_bytes(&self) -> Self

Reverses the byte order of the integer.

source

pub const fn to_le_bytes(&self) -> [u8; 7]

source

pub const fn from_le_bytes(from: [u8; 7]) -> Self

source

pub const fn to_be_bytes(&self) -> [u8; 7]

source

pub const fn from_be_bytes(from: [u8; 7]) -> Self

source

pub const fn to_ne_bytes(&self) -> [u8; 7]

source

pub const fn from_ne_bytes(bytes: [u8; 7]) -> Self

source

pub const fn to_le(self) -> Self

source

pub const fn to_be(self) -> Self

source

pub const fn from_le(value: Self) -> Self

source

pub const fn from_be(value: Self) -> Self

source§

impl UInt<u128, 72>

source

pub const fn swap_bytes(&self) -> Self

Reverses the byte order of the integer.

source

pub const fn to_le_bytes(&self) -> [u8; 9]

source

pub const fn from_le_bytes(from: [u8; 9]) -> Self

source

pub const fn to_be_bytes(&self) -> [u8; 9]

source

pub const fn from_be_bytes(from: [u8; 9]) -> Self

source

pub const fn to_ne_bytes(&self) -> [u8; 9]

source

pub const fn from_ne_bytes(bytes: [u8; 9]) -> Self

source

pub const fn to_le(self) -> Self

source

pub const fn to_be(self) -> Self

source

pub const fn from_le(value: Self) -> Self

source

pub const fn from_be(value: Self) -> Self

source§

impl UInt<u128, 80>

source

pub const fn swap_bytes(&self) -> Self

Reverses the byte order of the integer.

source

pub const fn to_le_bytes(&self) -> [u8; 10]

source

pub const fn from_le_bytes(from: [u8; 10]) -> Self

source

pub const fn to_be_bytes(&self) -> [u8; 10]

source

pub const fn from_be_bytes(from: [u8; 10]) -> Self

source

pub const fn to_ne_bytes(&self) -> [u8; 10]

source

pub const fn from_ne_bytes(bytes: [u8; 10]) -> Self

source

pub const fn to_le(self) -> Self

source

pub const fn to_be(self) -> Self

source

pub const fn from_le(value: Self) -> Self

source

pub const fn from_be(value: Self) -> Self

source§

impl UInt<u128, 88>

source

pub const fn swap_bytes(&self) -> Self

Reverses the byte order of the integer.

source

pub const fn to_le_bytes(&self) -> [u8; 11]

source

pub const fn from_le_bytes(from: [u8; 11]) -> Self

source

pub const fn to_be_bytes(&self) -> [u8; 11]

source

pub const fn from_be_bytes(from: [u8; 11]) -> Self

source

pub const fn to_ne_bytes(&self) -> [u8; 11]

source

pub const fn from_ne_bytes(bytes: [u8; 11]) -> Self

source

pub const fn to_le(self) -> Self

source

pub const fn to_be(self) -> Self

source

pub const fn from_le(value: Self) -> Self

source

pub const fn from_be(value: Self) -> Self

source§

impl UInt<u128, 96>

source

pub const fn swap_bytes(&self) -> Self

Reverses the byte order of the integer.

source

pub const fn to_le_bytes(&self) -> [u8; 12]

source

pub const fn from_le_bytes(from: [u8; 12]) -> Self

source

pub const fn to_be_bytes(&self) -> [u8; 12]

source

pub const fn from_be_bytes(from: [u8; 12]) -> Self

source

pub const fn to_ne_bytes(&self) -> [u8; 12]

source

pub const fn from_ne_bytes(bytes: [u8; 12]) -> Self

source

pub const fn to_le(self) -> Self

source

pub const fn to_be(self) -> Self

source

pub const fn from_le(value: Self) -> Self

source

pub const fn from_be(value: Self) -> Self

source§

impl UInt<u128, 104>

source

pub const fn swap_bytes(&self) -> Self

Reverses the byte order of the integer.

source

pub const fn to_le_bytes(&self) -> [u8; 13]

source

pub const fn from_le_bytes(from: [u8; 13]) -> Self

source

pub const fn to_be_bytes(&self) -> [u8; 13]

source

pub const fn from_be_bytes(from: [u8; 13]) -> Self

source

pub const fn to_ne_bytes(&self) -> [u8; 13]

source

pub const fn from_ne_bytes(bytes: [u8; 13]) -> Self

source

pub const fn to_le(self) -> Self

source

pub const fn to_be(self) -> Self

source

pub const fn from_le(value: Self) -> Self

source

pub const fn from_be(value: Self) -> Self

source§

impl UInt<u128, 112>

source

pub const fn swap_bytes(&self) -> Self

Reverses the byte order of the integer.

source

pub const fn to_le_bytes(&self) -> [u8; 14]

source

pub const fn from_le_bytes(from: [u8; 14]) -> Self

source

pub const fn to_be_bytes(&self) -> [u8; 14]

source

pub const fn from_be_bytes(from: [u8; 14]) -> Self

source

pub const fn to_ne_bytes(&self) -> [u8; 14]

source

pub const fn from_ne_bytes(bytes: [u8; 14]) -> Self

source

pub const fn to_le(self) -> Self

source

pub const fn to_be(self) -> Self

source

pub const fn from_le(value: Self) -> Self

source

pub const fn from_be(value: Self) -> Self

source§

impl UInt<u128, 120>

source

pub const fn swap_bytes(&self) -> Self

Reverses the byte order of the integer.

source

pub const fn to_le_bytes(&self) -> [u8; 15]

source

pub const fn from_le_bytes(from: [u8; 15]) -> Self

source

pub const fn to_be_bytes(&self) -> [u8; 15]

source

pub const fn from_be_bytes(from: [u8; 15]) -> Self

source

pub const fn to_ne_bytes(&self) -> [u8; 15]

source

pub const fn from_ne_bytes(bytes: [u8; 15]) -> Self

source

pub const fn to_le(self) -> Self

source

pub const fn to_be(self) -> Self

source

pub const fn from_le(value: Self) -> Self

source

pub const fn from_be(value: Self) -> Self

Trait Implementations§

source§

impl<T, const BITS: usize> Add<UInt<T, BITS>> for UInt<T, BITS>where Self: Number, T: PartialEq + Copy + BitAnd<T, Output = T> + Not<Output = T> + Add<T, Output = T> + Sub<T, Output = T> + Shr<usize, Output = T> + Shl<usize, Output = T> + From<u8>,

§

type Output = UInt<T, BITS>

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl<T, const BITS: usize> AddAssign<UInt<T, BITS>> for UInt<T, BITS>where Self: Number, T: PartialEq + Eq + Not<Output = T> + Copy + AddAssign<T> + BitAnd<T, Output = T> + BitAndAssign<T> + Sub<T, Output = T> + Shr<usize, Output = T> + Shl<usize, Output = T> + From<u8>,

source§

fn add_assign(&mut self, rhs: Self)

Performs the += operation. Read more
source§

impl<T, const BITS: usize> Binary for UInt<T, BITS>where T: Binary,

source§

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

Formats the value using the given formatter.
source§

impl<T, const BITS: usize> BitAnd<UInt<T, BITS>> for UInt<T, BITS>where Self: Number, T: Copy + BitAnd<T, Output = T> + Sub<T, Output = T> + Shl<usize, Output = T> + Shr<usize, Output = T> + From<u8>,

§

type Output = UInt<T, BITS>

The resulting type after applying the & operator.
source§

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

Performs the & operation. Read more
source§

impl<T, const BITS: usize> BitAndAssign<UInt<T, BITS>> for UInt<T, BITS>where T: Copy + BitAndAssign<T> + Sub<T, Output = T> + Shl<usize, Output = T> + From<u8>,

source§

fn bitand_assign(&mut self, rhs: Self)

Performs the &= operation. Read more
source§

impl<T, const BITS: usize> BitOr<UInt<T, BITS>> for UInt<T, BITS>where T: Copy + BitOr<T, Output = T> + Sub<T, Output = T> + Shl<usize, Output = T> + From<u8>,

§

type Output = UInt<T, BITS>

The resulting type after applying the | operator.
source§

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

Performs the | operation. Read more
source§

impl<T, const BITS: usize> BitOrAssign<UInt<T, BITS>> for UInt<T, BITS>where T: Copy + BitOrAssign<T> + Sub<T, Output = T> + Shl<usize, Output = T> + From<u8>,

source§

fn bitor_assign(&mut self, rhs: Self)

Performs the |= operation. Read more
source§

impl<T, const BITS: usize> BitXor<UInt<T, BITS>> for UInt<T, BITS>where T: Copy + BitXor<T, Output = T> + Sub<T, Output = T> + Shl<usize, Output = T> + From<u8>,

§

type Output = UInt<T, BITS>

The resulting type after applying the ^ operator.
source§

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

Performs the ^ operation. Read more
source§

impl<T, const BITS: usize> BitXorAssign<UInt<T, BITS>> for UInt<T, BITS>where T: Copy + BitXorAssign<T> + Sub<T, Output = T> + Shl<usize, Output = T> + From<u8>,

source§

fn bitxor_assign(&mut self, rhs: Self)

Performs the ^= operation. Read more
source§

impl<T: Clone, const BITS: usize> Clone for UInt<T, BITS>

source§

fn clone(&self) -> UInt<T, BITS>

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 BITS: usize> Debug for UInt<T, BITS>where T: Debug,

source§

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

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

impl<T: Default, const BITS: usize> Default for UInt<T, BITS>

source§

fn default() -> UInt<T, BITS>

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

impl<T, const BITS: usize> Display for UInt<T, BITS>where T: Display,

source§

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

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

impl<const BITS: usize> From<UInt<u128, BITS>> for u128

source§

fn from(from: UInt<u128, BITS>) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize> From<UInt<u128, BITS>> for u16

source§

fn from(from: UInt<u128, BITS>) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize> From<UInt<u128, BITS>> for u32

source§

fn from(from: UInt<u128, BITS>) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize> From<UInt<u128, BITS>> for u64

source§

fn from(from: UInt<u128, BITS>) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize> From<UInt<u128, BITS>> for u8

source§

fn from(from: UInt<u128, BITS>) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize, const BITS_FROM: usize> From<UInt<u128, BITS_FROM>> for UInt<u16, BITS>

source§

fn from(item: UInt<u128, BITS_FROM>) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize, const BITS_FROM: usize> From<UInt<u128, BITS_FROM>> for UInt<u32, BITS>

source§

fn from(item: UInt<u128, BITS_FROM>) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize, const BITS_FROM: usize> From<UInt<u128, BITS_FROM>> for UInt<u64, BITS>

source§

fn from(item: UInt<u128, BITS_FROM>) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize, const BITS_FROM: usize> From<UInt<u128, BITS_FROM>> for UInt<u8, BITS>

source§

fn from(item: UInt<u128, BITS_FROM>) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize> From<UInt<u16, BITS>> for u128

source§

fn from(from: UInt<u16, BITS>) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize> From<UInt<u16, BITS>> for u16

source§

fn from(from: UInt<u16, BITS>) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize> From<UInt<u16, BITS>> for u32

source§

fn from(from: UInt<u16, BITS>) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize> From<UInt<u16, BITS>> for u64

source§

fn from(from: UInt<u16, BITS>) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize> From<UInt<u16, BITS>> for u8

source§

fn from(from: UInt<u16, BITS>) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize, const BITS_FROM: usize> From<UInt<u16, BITS_FROM>> for UInt<u128, BITS>

source§

fn from(item: UInt<u16, BITS_FROM>) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize, const BITS_FROM: usize> From<UInt<u16, BITS_FROM>> for UInt<u32, BITS>

source§

fn from(item: UInt<u16, BITS_FROM>) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize, const BITS_FROM: usize> From<UInt<u16, BITS_FROM>> for UInt<u64, BITS>

source§

fn from(item: UInt<u16, BITS_FROM>) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize, const BITS_FROM: usize> From<UInt<u16, BITS_FROM>> for UInt<u8, BITS>

source§

fn from(item: UInt<u16, BITS_FROM>) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize> From<UInt<u32, BITS>> for u128

source§

fn from(from: UInt<u32, BITS>) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize> From<UInt<u32, BITS>> for u16

source§

fn from(from: UInt<u32, BITS>) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize> From<UInt<u32, BITS>> for u32

source§

fn from(from: UInt<u32, BITS>) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize> From<UInt<u32, BITS>> for u64

source§

fn from(from: UInt<u32, BITS>) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize> From<UInt<u32, BITS>> for u8

source§

fn from(from: UInt<u32, BITS>) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize, const BITS_FROM: usize> From<UInt<u32, BITS_FROM>> for UInt<u128, BITS>

source§

fn from(item: UInt<u32, BITS_FROM>) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize, const BITS_FROM: usize> From<UInt<u32, BITS_FROM>> for UInt<u16, BITS>

source§

fn from(item: UInt<u32, BITS_FROM>) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize, const BITS_FROM: usize> From<UInt<u32, BITS_FROM>> for UInt<u64, BITS>

source§

fn from(item: UInt<u32, BITS_FROM>) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize, const BITS_FROM: usize> From<UInt<u32, BITS_FROM>> for UInt<u8, BITS>

source§

fn from(item: UInt<u32, BITS_FROM>) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize> From<UInt<u64, BITS>> for u128

source§

fn from(from: UInt<u64, BITS>) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize> From<UInt<u64, BITS>> for u16

source§

fn from(from: UInt<u64, BITS>) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize> From<UInt<u64, BITS>> for u32

source§

fn from(from: UInt<u64, BITS>) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize> From<UInt<u64, BITS>> for u64

source§

fn from(from: UInt<u64, BITS>) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize> From<UInt<u64, BITS>> for u8

source§

fn from(from: UInt<u64, BITS>) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize, const BITS_FROM: usize> From<UInt<u64, BITS_FROM>> for UInt<u128, BITS>

source§

fn from(item: UInt<u64, BITS_FROM>) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize, const BITS_FROM: usize> From<UInt<u64, BITS_FROM>> for UInt<u16, BITS>

source§

fn from(item: UInt<u64, BITS_FROM>) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize, const BITS_FROM: usize> From<UInt<u64, BITS_FROM>> for UInt<u32, BITS>

source§

fn from(item: UInt<u64, BITS_FROM>) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize, const BITS_FROM: usize> From<UInt<u64, BITS_FROM>> for UInt<u8, BITS>

source§

fn from(item: UInt<u64, BITS_FROM>) -> Self

Converts to this type from the input type.
source§

impl From<UInt<u8, 1>> for bool

source§

fn from(value: u1) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize> From<UInt<u8, BITS>> for u128

source§

fn from(from: UInt<u8, BITS>) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize> From<UInt<u8, BITS>> for u16

source§

fn from(from: UInt<u8, BITS>) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize> From<UInt<u8, BITS>> for u32

source§

fn from(from: UInt<u8, BITS>) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize> From<UInt<u8, BITS>> for u64

source§

fn from(from: UInt<u8, BITS>) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize> From<UInt<u8, BITS>> for u8

source§

fn from(from: UInt<u8, BITS>) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize, const BITS_FROM: usize> From<UInt<u8, BITS_FROM>> for UInt<u128, BITS>

source§

fn from(item: UInt<u8, BITS_FROM>) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize, const BITS_FROM: usize> From<UInt<u8, BITS_FROM>> for UInt<u16, BITS>

source§

fn from(item: UInt<u8, BITS_FROM>) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize, const BITS_FROM: usize> From<UInt<u8, BITS_FROM>> for UInt<u32, BITS>

source§

fn from(item: UInt<u8, BITS_FROM>) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize, const BITS_FROM: usize> From<UInt<u8, BITS_FROM>> for UInt<u64, BITS>

source§

fn from(item: UInt<u8, BITS_FROM>) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize> From<u128> for UInt<u128, BITS>

source§

fn from(from: u128) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize> From<u128> for UInt<u16, BITS>

source§

fn from(from: u128) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize> From<u128> for UInt<u32, BITS>

source§

fn from(from: u128) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize> From<u128> for UInt<u64, BITS>

source§

fn from(from: u128) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize> From<u128> for UInt<u8, BITS>

source§

fn from(from: u128) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize> From<u16> for UInt<u128, BITS>

source§

fn from(from: u16) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize> From<u16> for UInt<u16, BITS>

source§

fn from(from: u16) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize> From<u16> for UInt<u32, BITS>

source§

fn from(from: u16) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize> From<u16> for UInt<u64, BITS>

source§

fn from(from: u16) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize> From<u16> for UInt<u8, BITS>

source§

fn from(from: u16) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize> From<u32> for UInt<u128, BITS>

source§

fn from(from: u32) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize> From<u32> for UInt<u16, BITS>

source§

fn from(from: u32) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize> From<u32> for UInt<u32, BITS>

source§

fn from(from: u32) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize> From<u32> for UInt<u64, BITS>

source§

fn from(from: u32) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize> From<u32> for UInt<u8, BITS>

source§

fn from(from: u32) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize> From<u64> for UInt<u128, BITS>

source§

fn from(from: u64) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize> From<u64> for UInt<u16, BITS>

source§

fn from(from: u64) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize> From<u64> for UInt<u32, BITS>

source§

fn from(from: u64) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize> From<u64> for UInt<u64, BITS>

source§

fn from(from: u64) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize> From<u64> for UInt<u8, BITS>

source§

fn from(from: u64) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize> From<u8> for UInt<u128, BITS>

source§

fn from(from: u8) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize> From<u8> for UInt<u16, BITS>

source§

fn from(from: u8) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize> From<u8> for UInt<u32, BITS>

source§

fn from(from: u8) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize> From<u8> for UInt<u64, BITS>

source§

fn from(from: u8) -> Self

Converts to this type from the input type.
source§

impl<const BITS: usize> From<u8> for UInt<u8, BITS>

source§

fn from(from: u8) -> Self

Converts to this type from the input type.
source§

impl<T, const BITS: usize> Hash for UInt<T, BITS>where T: Hash,

source§

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

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

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

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

impl<T, const BITS: usize> LowerHex for UInt<T, BITS>where T: LowerHex,

source§

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

Formats the value using the given formatter.
source§

impl<T, const BITS: usize> Not for UInt<T, BITS>where Self: Number, T: Copy + BitAnd<T, Output = T> + BitXor<T, Output = T> + Sub<T, Output = T> + Shl<usize, Output = T> + Shr<usize, Output = T> + From<u8>,

§

type Output = UInt<T, BITS>

The resulting type after applying the ! operator.
source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
source§

impl<const BITS: usize> Number for UInt<u128, BITS>

§

type UnderlyingType = u128

source§

const BITS: usize = BITS

Number of bits that can fit in this type
source§

const MIN: Self = _

Minimum value that can be represented by this type
source§

const MAX: Self = _

Maximum value that can be represented by this type
source§

fn try_new(value: Self::UnderlyingType) -> Result<Self, TryNewError>

source§

fn new(value: u128) -> Self

source§

fn value(self) -> u128

source§

impl<const BITS: usize> Number for UInt<u16, BITS>

§

type UnderlyingType = u16

source§

const BITS: usize = BITS

Number of bits that can fit in this type
source§

const MIN: Self = _

Minimum value that can be represented by this type
source§

const MAX: Self = _

Maximum value that can be represented by this type
source§

fn try_new(value: Self::UnderlyingType) -> Result<Self, TryNewError>

source§

fn new(value: u16) -> Self

source§

fn value(self) -> u16

source§

impl<const BITS: usize> Number for UInt<u32, BITS>

§

type UnderlyingType = u32

source§

const BITS: usize = BITS

Number of bits that can fit in this type
source§

const MIN: Self = _

Minimum value that can be represented by this type
source§

const MAX: Self = _

Maximum value that can be represented by this type
source§

fn try_new(value: Self::UnderlyingType) -> Result<Self, TryNewError>

source§

fn new(value: u32) -> Self

source§

fn value(self) -> u32

source§

impl<const BITS: usize> Number for UInt<u64, BITS>

§

type UnderlyingType = u64

source§

const BITS: usize = BITS

Number of bits that can fit in this type
source§

const MIN: Self = _

Minimum value that can be represented by this type
source§

const MAX: Self = _

Maximum value that can be represented by this type
source§

fn try_new(value: Self::UnderlyingType) -> Result<Self, TryNewError>

source§

fn new(value: u64) -> Self

source§

fn value(self) -> u64

source§

impl<const BITS: usize> Number for UInt<u8, BITS>

§

type UnderlyingType = u8

source§

const BITS: usize = BITS

Number of bits that can fit in this type
source§

const MIN: Self = _

Minimum value that can be represented by this type
source§

const MAX: Self = _

Maximum value that can be represented by this type
source§

fn try_new(value: Self::UnderlyingType) -> Result<Self, TryNewError>

source§

fn new(value: u8) -> Self

source§

fn value(self) -> u8

source§

impl<T, const BITS: usize> Octal for UInt<T, BITS>where T: Octal,

source§

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

Formats the value using the given formatter.
source§

impl<T: Ord, const BITS: usize> Ord for UInt<T, BITS>

source§

fn cmp(&self, other: &UInt<T, BITS>) -> Ordering

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

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

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

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

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

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

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

impl<T: PartialEq, const BITS: usize> PartialEq<UInt<T, BITS>> for UInt<T, BITS>

source§

fn eq(&self, other: &UInt<T, BITS>) -> bool

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

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

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

impl<T: PartialOrd, const BITS: usize> PartialOrd<UInt<T, BITS>> for UInt<T, BITS>

source§

fn partial_cmp(&self, other: &UInt<T, BITS>) -> Option<Ordering>

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

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

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

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

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

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

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

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

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

impl<T, TSHIFTBITS, const BITS: usize> Shl<TSHIFTBITS> for UInt<T, BITS>where Self: Number, T: Copy + BitAnd<T, Output = T> + Shl<TSHIFTBITS, Output = T> + Sub<T, Output = T> + Shl<usize, Output = T> + Shr<usize, Output = T> + From<u8>,

§

type Output = UInt<T, BITS>

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

fn shl(self, rhs: TSHIFTBITS) -> Self::Output

Performs the << operation. Read more
source§

impl<T, TSHIFTBITS, const BITS: usize> ShlAssign<TSHIFTBITS> for UInt<T, BITS>where Self: Number, T: Copy + BitAnd<T, Output = T> + BitAndAssign<T> + ShlAssign<TSHIFTBITS> + Sub<T, Output = T> + Shr<usize, Output = T> + Shl<usize, Output = T> + From<u8>,

source§

fn shl_assign(&mut self, rhs: TSHIFTBITS)

Performs the <<= operation. Read more
source§

impl<T, TSHIFTBITS, const BITS: usize> Shr<TSHIFTBITS> for UInt<T, BITS>where T: Copy + Shr<TSHIFTBITS, Output = T> + Sub<T, Output = T> + Shl<usize, Output = T> + From<u8>,

§

type Output = UInt<T, BITS>

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

fn shr(self, rhs: TSHIFTBITS) -> Self::Output

Performs the >> operation. Read more
source§

impl<T, TSHIFTBITS, const BITS: usize> ShrAssign<TSHIFTBITS> for UInt<T, BITS>where T: Copy + ShrAssign<TSHIFTBITS> + Sub<T, Output = T> + Shl<usize, Output = T> + From<u8>,

source§

fn shr_assign(&mut self, rhs: TSHIFTBITS)

Performs the >>= operation. Read more
source§

impl<T, const BITS: usize> Sub<UInt<T, BITS>> for UInt<T, BITS>where Self: Number, T: Copy + BitAnd<T, Output = T> + Sub<T, Output = T> + Shl<usize, Output = T> + Shr<usize, Output = T> + From<u8>,

§

type Output = UInt<T, BITS>

The resulting type after applying the - operator.
source§

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

Performs the - operation. Read more
source§

impl<T, const BITS: usize> SubAssign<UInt<T, BITS>> for UInt<T, BITS>where Self: Number, T: Copy + SubAssign<T> + BitAnd<T, Output = T> + BitAndAssign<T> + Sub<T, Output = T> + Shl<usize, Output = T> + Shr<usize, Output = T> + From<u8>,

source§

fn sub_assign(&mut self, rhs: Self)

Performs the -= operation. Read more
source§

impl<T, const BITS: usize> UpperHex for UInt<T, BITS>where T: UpperHex,

source§

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

Formats the value using the given formatter.
source§

impl<T: Copy, const BITS: usize> Copy for UInt<T, BITS>

source§

impl<T: Eq, const BITS: usize> Eq for UInt<T, BITS>

source§

impl<T, const BITS: usize> StructuralEq for UInt<T, BITS>

source§

impl<T, const BITS: usize> StructuralPartialEq for UInt<T, BITS>

Auto Trait Implementations§

§

impl<T, const BITS: usize> RefUnwindSafe for UInt<T, BITS>where T: RefUnwindSafe,

§

impl<T, const BITS: usize> Send for UInt<T, BITS>where T: Send,

§

impl<T, const BITS: usize> Sync for UInt<T, BITS>where T: Sync,

§

impl<T, const BITS: usize> Unpin for UInt<T, BITS>where T: Unpin,

§

impl<T, const BITS: usize> UnwindSafe for UInt<T, BITS>where T: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere 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, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

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

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

Performs the conversion.
source§

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

§

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

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

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

Performs the conversion.