Struct 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 from_u8(value: u8) -> Self

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

Source

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

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

Source

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

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

Source

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

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

Source

pub const fn from_u128(value: u128) -> 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 wrapping_add(self, rhs: Self) -> Self

Source

pub const fn wrapping_sub(self, rhs: Self) -> Self

Source

pub const fn wrapping_mul(self, rhs: Self) -> Self

Source

pub const fn wrapping_div(self, rhs: Self) -> Self

Source

pub const fn wrapping_shl(self, rhs: u32) -> Self

Source

pub const fn wrapping_shr(self, rhs: u32) -> Self

Source

pub const fn saturating_add(self, rhs: Self) -> Self

Source

pub const fn saturating_sub(self, rhs: Self) -> Self

Source

pub const fn saturating_mul(self, rhs: Self) -> Self

Source

pub const fn saturating_div(self, rhs: Self) -> Self

Source

pub const fn saturating_pow(self, exp: u32) -> Self

Source

pub const fn checked_add(self, rhs: Self) -> Option<Self>

Source

pub const fn checked_sub(self, rhs: Self) -> Option<Self>

Source

pub const fn checked_mul(self, rhs: Self) -> Option<Self>

Source

pub const fn checked_div(self, rhs: Self) -> Option<Self>

Source

pub const fn checked_shl(self, rhs: u32) -> Option<Self>

Source

pub const fn checked_shr(self, rhs: u32) -> Option<Self>

Source

pub const fn overflowing_add(self, rhs: Self) -> (Self, bool)

Source

pub const fn overflowing_sub(self, rhs: Self) -> (Self, bool)

Source

pub const fn overflowing_mul(self, rhs: Self) -> (Self, bool)

Source

pub const fn overflowing_div(self, rhs: Self) -> (Self, bool)

Source

pub const fn overflowing_shl(self, rhs: u32) -> (Self, bool)

Source

pub const fn overflowing_shr(self, rhs: u32) -> (Self, bool)

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 from_u8(value: u8) -> Self

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

Source

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

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

Source

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

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

Source

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

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

Source

pub const fn from_u128(value: u128) -> 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 wrapping_add(self, rhs: Self) -> Self

Source

pub const fn wrapping_sub(self, rhs: Self) -> Self

Source

pub const fn wrapping_mul(self, rhs: Self) -> Self

Source

pub const fn wrapping_div(self, rhs: Self) -> Self

Source

pub const fn wrapping_shl(self, rhs: u32) -> Self

Source

pub const fn wrapping_shr(self, rhs: u32) -> Self

Source

pub const fn saturating_add(self, rhs: Self) -> Self

Source

pub const fn saturating_sub(self, rhs: Self) -> Self

Source

pub const fn saturating_mul(self, rhs: Self) -> Self

Source

pub const fn saturating_div(self, rhs: Self) -> Self

Source

pub const fn saturating_pow(self, exp: u32) -> Self

Source

pub const fn checked_add(self, rhs: Self) -> Option<Self>

Source

pub const fn checked_sub(self, rhs: Self) -> Option<Self>

Source

pub const fn checked_mul(self, rhs: Self) -> Option<Self>

Source

pub const fn checked_div(self, rhs: Self) -> Option<Self>

Source

pub const fn checked_shl(self, rhs: u32) -> Option<Self>

Source

pub const fn checked_shr(self, rhs: u32) -> Option<Self>

Source

pub const fn overflowing_add(self, rhs: Self) -> (Self, bool)

Source

pub const fn overflowing_sub(self, rhs: Self) -> (Self, bool)

Source

pub const fn overflowing_mul(self, rhs: Self) -> (Self, bool)

Source

pub const fn overflowing_div(self, rhs: Self) -> (Self, bool)

Source

pub const fn overflowing_shl(self, rhs: u32) -> (Self, bool)

Source

pub const fn overflowing_shr(self, rhs: u32) -> (Self, bool)

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 from_u8(value: u8) -> Self

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

Source

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

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

Source

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

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

Source

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

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

Source

pub const fn from_u128(value: u128) -> 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 wrapping_add(self, rhs: Self) -> Self

Source

pub const fn wrapping_sub(self, rhs: Self) -> Self

Source

pub const fn wrapping_mul(self, rhs: Self) -> Self

Source

pub const fn wrapping_div(self, rhs: Self) -> Self

Source

pub const fn wrapping_shl(self, rhs: u32) -> Self

Source

pub const fn wrapping_shr(self, rhs: u32) -> Self

Source

pub const fn saturating_add(self, rhs: Self) -> Self

Source

pub const fn saturating_sub(self, rhs: Self) -> Self

Source

pub const fn saturating_mul(self, rhs: Self) -> Self

Source

pub const fn saturating_div(self, rhs: Self) -> Self

Source

pub const fn saturating_pow(self, exp: u32) -> Self

Source

pub const fn checked_add(self, rhs: Self) -> Option<Self>

Source

pub const fn checked_sub(self, rhs: Self) -> Option<Self>

Source

pub const fn checked_mul(self, rhs: Self) -> Option<Self>

Source

pub const fn checked_div(self, rhs: Self) -> Option<Self>

Source

pub const fn checked_shl(self, rhs: u32) -> Option<Self>

Source

pub const fn checked_shr(self, rhs: u32) -> Option<Self>

Source

pub const fn overflowing_add(self, rhs: Self) -> (Self, bool)

Source

pub const fn overflowing_sub(self, rhs: Self) -> (Self, bool)

Source

pub const fn overflowing_mul(self, rhs: Self) -> (Self, bool)

Source

pub const fn overflowing_div(self, rhs: Self) -> (Self, bool)

Source

pub const fn overflowing_shl(self, rhs: u32) -> (Self, bool)

Source

pub const fn overflowing_shr(self, rhs: u32) -> (Self, bool)

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 from_u8(value: u8) -> Self

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

Source

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

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

Source

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

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

Source

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

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

Source

pub const fn from_u128(value: u128) -> 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 wrapping_add(self, rhs: Self) -> Self

Source

pub const fn wrapping_sub(self, rhs: Self) -> Self

Source

pub const fn wrapping_mul(self, rhs: Self) -> Self

Source

pub const fn wrapping_div(self, rhs: Self) -> Self

Source

pub const fn wrapping_shl(self, rhs: u32) -> Self

Source

pub const fn wrapping_shr(self, rhs: u32) -> Self

Source

pub const fn saturating_add(self, rhs: Self) -> Self

Source

pub const fn saturating_sub(self, rhs: Self) -> Self

Source

pub const fn saturating_mul(self, rhs: Self) -> Self

Source

pub const fn saturating_div(self, rhs: Self) -> Self

Source

pub const fn saturating_pow(self, exp: u32) -> Self

Source

pub const fn checked_add(self, rhs: Self) -> Option<Self>

Source

pub const fn checked_sub(self, rhs: Self) -> Option<Self>

Source

pub const fn checked_mul(self, rhs: Self) -> Option<Self>

Source

pub const fn checked_div(self, rhs: Self) -> Option<Self>

Source

pub const fn checked_shl(self, rhs: u32) -> Option<Self>

Source

pub const fn checked_shr(self, rhs: u32) -> Option<Self>

Source

pub const fn overflowing_add(self, rhs: Self) -> (Self, bool)

Source

pub const fn overflowing_sub(self, rhs: Self) -> (Self, bool)

Source

pub const fn overflowing_mul(self, rhs: Self) -> (Self, bool)

Source

pub const fn overflowing_div(self, rhs: Self) -> (Self, bool)

Source

pub const fn overflowing_shl(self, rhs: u32) -> (Self, bool)

Source

pub const fn overflowing_shr(self, rhs: u32) -> (Self, bool)

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 from_u8(value: u8) -> Self

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

Source

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

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

Source

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

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

Source

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

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

Source

pub const fn from_u128(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 wrapping_add(self, rhs: Self) -> Self

Source

pub const fn wrapping_sub(self, rhs: Self) -> Self

Source

pub const fn wrapping_mul(self, rhs: Self) -> Self

Source

pub const fn wrapping_div(self, rhs: Self) -> Self

Source

pub const fn wrapping_shl(self, rhs: u32) -> Self

Source

pub const fn wrapping_shr(self, rhs: u32) -> Self

Source

pub const fn saturating_add(self, rhs: Self) -> Self

Source

pub const fn saturating_sub(self, rhs: Self) -> Self

Source

pub const fn saturating_mul(self, rhs: Self) -> Self

Source

pub const fn saturating_div(self, rhs: Self) -> Self

Source

pub const fn saturating_pow(self, exp: u32) -> Self

Source

pub const fn checked_add(self, rhs: Self) -> Option<Self>

Source

pub const fn checked_sub(self, rhs: Self) -> Option<Self>

Source

pub const fn checked_mul(self, rhs: Self) -> Option<Self>

Source

pub const fn checked_div(self, rhs: Self) -> Option<Self>

Source

pub const fn checked_shl(self, rhs: u32) -> Option<Self>

Source

pub const fn checked_shr(self, rhs: u32) -> Option<Self>

Source

pub const fn overflowing_add(self, rhs: Self) -> (Self, bool)

Source

pub const fn overflowing_sub(self, rhs: Self) -> (Self, bool)

Source

pub const fn overflowing_mul(self, rhs: Self) -> (Self, bool)

Source

pub const fn overflowing_div(self, rhs: Self) -> (Self, bool)

Source

pub const fn overflowing_shl(self, rhs: u32) -> (Self, bool)

Source

pub const fn overflowing_shr(self, rhs: u32) -> (Self, bool)

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 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> + From<u8>,

Source§

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 for UInt<T, BITS>
where Self: Number, T: PartialEq + Eq + Not<Output = T> + Copy + AddAssign<T> + BitAnd<T, Output = T> + BitAndAssign<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. Read more
Source§

impl<T, const BITS: usize> BitAnd 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>,

Source§

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 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 for UInt<T, BITS>
where T: Copy + BitOr<T, Output = T> + Sub<T, Output = T> + Shl<usize, Output = T> + From<u8>,

Source§

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 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 for UInt<T, BITS>
where T: Copy + BitXor<T, Output = T> + Sub<T, Output = T> + Shl<usize, Output = T> + From<u8>,

Source§

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 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 duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T, 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<T, const BITS: usize> Div for UInt<T, BITS>
where Self: Number, T: PartialEq + Div<T, Output = T>,

Source§

type Output = UInt<T, BITS>

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl<T, const BITS: usize> DivAssign for UInt<T, BITS>
where Self: Number, T: PartialEq + DivAssign<T>,

Source§

fn div_assign(&mut self, rhs: Self)

Performs the /= operation. 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. Read more
Source§

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

Source§

type Output = UInt<T, BITS>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

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

Source§

fn mul_assign(&mut self, rhs: Self)

Performs the *= operation. Read more
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>,

Source§

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>

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§

type UnderlyingType = u128

Source§

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

Creates a number from the given value, return None if the value is too large
Source§

fn new(value: u128) -> Self

Creates a number from the given value, throwing an error if the value is too large. This constructor is useful when creating a value from a literal.
Source§

fn from_<T: Number>(value: T) -> Self

Creates a number from the given value, throwing an error if the value is too large. This constructor is useful when the value is convertable to T. Use Self::new for literals.
Source§

fn masked_new<T: Number>(value: T) -> Self

Creates an instance from the given value. Unlike the various new... functions, this will never fail as the value is masked to the result size.
Source§

fn as_u8(&self) -> u8

Source§

fn as_u16(&self) -> u16

Source§

fn as_u32(&self) -> u32

Source§

fn as_u64(&self) -> u64

Source§

fn as_u128(&self) -> u128

Source§

fn as_usize(&self) -> usize

Source§

fn value(self) -> u128

Source§

fn as_<T: Number>(self) -> T

Source§

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

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§

type UnderlyingType = u16

Source§

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

Creates a number from the given value, return None if the value is too large
Source§

fn new(value: u16) -> Self

Creates a number from the given value, throwing an error if the value is too large. This constructor is useful when creating a value from a literal.
Source§

fn from_<T: Number>(value: T) -> Self

Creates a number from the given value, throwing an error if the value is too large. This constructor is useful when the value is convertable to T. Use Self::new for literals.
Source§

fn masked_new<T: Number>(value: T) -> Self

Creates an instance from the given value. Unlike the various new... functions, this will never fail as the value is masked to the result size.
Source§

fn as_u8(&self) -> u8

Source§

fn as_u16(&self) -> u16

Source§

fn as_u32(&self) -> u32

Source§

fn as_u64(&self) -> u64

Source§

fn as_u128(&self) -> u128

Source§

fn as_usize(&self) -> usize

Source§

fn value(self) -> u16

Source§

fn as_<T: Number>(self) -> T

Source§

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

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§

type UnderlyingType = u32

Source§

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

Creates a number from the given value, return None if the value is too large
Source§

fn new(value: u32) -> Self

Creates a number from the given value, throwing an error if the value is too large. This constructor is useful when creating a value from a literal.
Source§

fn from_<T: Number>(value: T) -> Self

Creates a number from the given value, throwing an error if the value is too large. This constructor is useful when the value is convertable to T. Use Self::new for literals.
Source§

fn masked_new<T: Number>(value: T) -> Self

Creates an instance from the given value. Unlike the various new... functions, this will never fail as the value is masked to the result size.
Source§

fn as_u8(&self) -> u8

Source§

fn as_u16(&self) -> u16

Source§

fn as_u32(&self) -> u32

Source§

fn as_u64(&self) -> u64

Source§

fn as_u128(&self) -> u128

Source§

fn as_usize(&self) -> usize

Source§

fn value(self) -> u32

Source§

fn as_<T: Number>(self) -> T

Source§

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

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§

type UnderlyingType = u64

Source§

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

Creates a number from the given value, return None if the value is too large
Source§

fn new(value: u64) -> Self

Creates a number from the given value, throwing an error if the value is too large. This constructor is useful when creating a value from a literal.
Source§

fn from_<T: Number>(value: T) -> Self

Creates a number from the given value, throwing an error if the value is too large. This constructor is useful when the value is convertable to T. Use Self::new for literals.
Source§

fn masked_new<T: Number>(value: T) -> Self

Creates an instance from the given value. Unlike the various new... functions, this will never fail as the value is masked to the result size.
Source§

fn as_u8(&self) -> u8

Source§

fn as_u16(&self) -> u16

Source§

fn as_u32(&self) -> u32

Source§

fn as_u64(&self) -> u64

Source§

fn as_u128(&self) -> u128

Source§

fn as_usize(&self) -> usize

Source§

fn value(self) -> u64

Source§

fn as_<T: Number>(self) -> T

Source§

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

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§

type UnderlyingType = u8

Source§

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

Creates a number from the given value, return None if the value is too large
Source§

fn new(value: u8) -> Self

Creates a number from the given value, throwing an error if the value is too large. This constructor is useful when creating a value from a literal.
Source§

fn from_<T: Number>(value: T) -> Self

Creates a number from the given value, throwing an error if the value is too large. This constructor is useful when the value is convertable to T. Use Self::new for literals.
Source§

fn masked_new<T: Number>(value: T) -> Self

Creates an instance from the given value. Unlike the various new... functions, this will never fail as the value is masked to the result size.
Source§

fn as_u8(&self) -> u8

Source§

fn as_u16(&self) -> u16

Source§

fn as_u32(&self) -> u32

Source§

fn as_u64(&self) -> u64

Source§

fn as_u128(&self) -> u128

Source§

fn as_usize(&self) -> usize

Source§

fn value(self) -> u8

Source§

fn as_<T: Number>(self) -> T

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. Read more
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) -> Self
where Self: Sized,

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

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

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

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

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

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

Source§

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

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

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

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

impl<T: PartialOrd, const BITS: usize> PartialOrd 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

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

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

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

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

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

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

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

impl<T, 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>, TSHIFTBITS: TryInto<usize> + Copy,

Source§

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>, TSHIFTBITS: TryInto<usize> + Copy,

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>, TSHIFTBITS: TryInto<usize> + Copy,

Source§

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>, TSHIFTBITS: TryInto<usize> + Copy,

Source§

fn shr_assign(&mut self, rhs: TSHIFTBITS)

Performs the >>= operation. Read more
Source§

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

Source§

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 for UInt<T, BITS>
where Self: Number, T: Copy + SubAssign<T> + BitAnd<T, Output = T> + BitAndAssign<T> + Sub<T, Output = T>,

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. Read more
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> StructuralPartialEq for UInt<T, BITS>

Auto Trait Implementations§

§

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

§

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 T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

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

Source§

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

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

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

Source§

type Error = Infallible

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

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

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.