Struct UInt

Source
pub struct UInt { /* private fields */ }
Expand description

Unsigned machine integer with arbitrary bitwidths and modulo arithmetics.

Thin convenience wrapper around ApInt for static unsigned interpretation of the value.

This very cheaply transformes to and from ApInt and Int instances and together with Int offers a more elegant and higher-level abstraction interface to the lower-level ApInt.

Implementations§

Source§

impl UInt

Source

pub fn into_apint(self) -> ApInt

Transforms this UInt into an equivalent ApInt instance.

Source

pub fn into_signed(self) -> Int

Transforms this UInt into an equivalent Int instance.

Source§

impl UInt

§Constructors

Source

pub fn from_bit<B>(bit: B) -> UInt
where B: Into<Bit>,

Creates a new UInt from the given Bit value with a bit width of 1.

This function is generic over types that are convertible to Bit such as bool.

Source

pub fn from_u8(val: u8) -> UInt

Creates a new UInt from a given u8 value with a bit-width of 8.

Source

pub fn from_u16(val: u16) -> UInt

Creates a new UInt from a given u16 value with a bit-width of 16.

Source

pub fn from_u32(val: u32) -> UInt

Creates a new UInt from a given u32 value with a bit-width of 32.

Source

pub fn from_u64(val: u64) -> UInt

Creates a new UInt from a given u64 value with a bit-width of 64.

Source

pub fn from_u128(val: u128) -> UInt

Creates a new UInt from a given u64 value with a bit-width of 64.

Source

pub fn zero(width: BitWidth) -> UInt

Creates a new UInt with the given bit width that represents zero.

Source

pub fn one(width: BitWidth) -> UInt

Creates a new UInt with the given bit width that represents one.

Source

pub fn all_unset(width: BitWidth) -> UInt

Creates a new UInt with the given bit width that has all bits unset.

Note: This is equal to calling UInt::zero with the given width.

Source

pub fn all_set(width: BitWidth) -> UInt

Creates a new UInt with the given bit width that has all bits set.

§Note
  • This is equal to minus one on any twos-complement machine.
Source

pub fn min_value(width: BitWidth) -> UInt

Returns the smallest UInt that can be represented by the given BitWidth.

Source

pub fn max_value(width: BitWidth) -> UInt

Returns the largest UInt that can be represented by the given BitWidth.

Source§

impl UInt

§Utilities

Source

pub fn is_zero(&self) -> bool

Returns true if this UInt represents the value zero (0).

§Note
  • Zero (0) is also called the additive neutral element.
  • This operation is more efficient than comparing two instances of UInt for the same reason.
Source

pub fn is_one(&self) -> bool

Returns true if this UInt represents the value one (1).

§Note
  • One (1) is also called the multiplicative neutral element.
  • This operation is more efficient than comparing two instances of UInt for the same reason.
Source

pub fn is_even(&self) -> bool

Returns true if this UInt represents an even number.

Source

pub fn is_odd(&self) -> bool

Returns true if this UInt represents an odd number.

Source§

impl UInt

Source

pub fn checked_lt(&self, rhs: &UInt) -> Result<bool>

Less-than (lt) comparison between self and rhs.

§Note
  • Returns Ok(true) if self < rhs.
  • Interprets both UInt instances as unsigned values.
§Errors
  • If self and rhs have unmatching bit widths.
Source

pub fn checked_le(&self, rhs: &UInt) -> Result<bool>

Less-equals (le) comparison between self and rhs.

§Note
  • Returns Ok(true) if self <= rhs.
  • Interprets both UInt instances as unsigned values.
§Errors
  • If self and rhs have unmatching bit widths.
Source

pub fn checked_gt(&self, rhs: &UInt) -> Result<bool>

Greater-than (gt) comparison between self and rhs.

§Note
  • Returns Ok(true) if self > rhs.
  • Interprets both UInt instances as unsigned values.
§Errors
  • If self and rhs have unmatching bit widths.
Source

pub fn checked_ge(&self, rhs: &UInt) -> Result<bool>

Greater-equals (ge) comparison between self and rhs.

§Note
  • Returns Ok(true) if self >= rhs.
  • Interprets both UInt instances as unsigned values.
§Errors
  • If self and rhs have unmatching bit widths.
Source§

impl UInt

§To Primitive (Resize)

Source

pub fn resize_to_bool(&self) -> bool

Resizes this UInt to a bool primitive type.

Bits in this UInt that are not within the bounds of the bool are being ignored.

§Note
  • Basically this returns true if the least significant bit of this UInt is 1 and false otherwise.
Source

pub fn resize_to_u8(&self) -> u8

Resizes this UInt to a u8 primitive type.

§Note
  • All bits but the least significant 8 bits are being ignored by this operation to construct the result.
Source

pub fn resize_to_u16(&self) -> u16

Resizes this UInt to a u16 primitive type.

§Note
  • All bits but the least significant 16 bits are being ignored by this operation to construct the result.
Source

pub fn resize_to_u32(&self) -> u32

Resizes this UInt to a u32 primitive type.

§Note
  • All bits but the least significant 32 bits are being ignored by this operation to construct the result.
Source

pub fn resize_to_u64(&self) -> u64

Resizes this UInt to a u64 primitive type.

§Note
  • All bits but the least significant 64 bits are being ignored by this operation to construct the result.
Source

pub fn resize_to_u128(&self) -> u128

Resizes this UInt to a u128 primitive type.

§Note
  • All bits but the least significant 128 bits are being ignored by this operation to construct the result.
Source§

impl UInt

§To Primitive (Try-Cast)

Source

pub fn try_to_bool(&self) -> Result<bool>

Tries to represent the value of this UInt as a bool.

§Note

This returns true if the value represented by this UInt is 1, returns false if the value represented by this UInt is 0 and returns an error otherwise.

§Errors
  • If the value represented by this UInt can not be represented by a bool.
Source

pub fn try_to_u8(&self) -> Result<u8>

Tries to represent the value of this UInt as a u8.

§Note
  • This conversion is possible as long as the value represented by this UInt does not exceed the maximum value of u8.
§Errors
  • If the value represented by this UInt can not be represented by a u8.
Source

pub fn try_to_u16(&self) -> Result<u16>

Tries to represent the value of this UInt as a u16.

§Note
  • This conversion is possible as long as the value represented by this UInt does not exceed the maximum value of u16.
§Errors
  • If the value represented by this UInt can not be represented by a u16.
Source

pub fn try_to_u32(&self) -> Result<u32>

Tries to represent the value of this UInt as a u32.

§Note
  • This conversion is possible as long as the value represented by this UInt does not exceed the maximum value of u32.
§Errors
  • If the value represented by this UInt can not be represented by a u32.
Source

pub fn try_to_u64(&self) -> Result<u64>

Tries to represent the value of this UInt as a u64.

§Note
  • This conversion is possible as long as the value represented by this UInt does not exceed the maximum value of u64.
§Errors
  • If the value represented by this UInt can not be represented by a u64.
Source

pub fn try_to_u128(&self) -> Result<u128>

Tries to represent the value of this UInt as a u128.

§Note
  • This conversion is possible as long as the value represented by this UInt does not exceed the maximum value of u128.
§Complexity
  • 𝒪(n) where n is the number of digits of this UInt.
§Errors
  • If the value represented by this UInt can not be represented by a u128.
Source§

impl UInt

§Shifts

Source

pub fn checked_shl_assign<S>(&mut self, shift_amount: S) -> Result<()>
where S: Into<ShiftAmount>,

Shift this UInt left by the given shift_amount bits.

This operation is inplace and will not allocate memory.

§Errors
  • If the given shift_amount is invalid for the bit width of this UInt.
Source

pub fn into_checked_shl<S>(self, shift_amount: S) -> Result<UInt>
where S: Into<ShiftAmount>,

Shift this UInt left by the given shift_amount bits and returns the result.

This operation is inplace and will not allocate memory.

§Errors
  • If the given shift_amount is invalid for the bit width of this UInt.
Source

pub fn checked_shr_assign<S>(&mut self, shift_amount: S) -> Result<()>
where S: Into<ShiftAmount>,

Right-shifts this UInt by the given shift_amount bits.

This operation is inplace and will not allocate memory.

§Errors
  • If the given shift_amount is invalid for the bit width of this UInt.
Source

pub fn into_checked_shr<S>(self, shift_amount: S) -> Result<UInt>
where S: Into<ShiftAmount>,

Right-shifts this UInt by the given shift_amount bits and returns the result.

This operation is inplace and will not allocate memory.

§Errors
  • If the given shift_amount is invalid for the bit width of this UInt.
Source§

impl UInt

§Random Utilities using rand crate.

Source

pub fn random_with_width(width: BitWidth) -> UInt

Creates a new UInt with the given BitWidth and random Digits.

Source

pub fn random_with_width_using<R>(width: BitWidth, rng: &mut R) -> UInt
where R: Rng,

Creates a new UInt with the given BitWidth and random Digits using the given random number generator.

Note: This is useful for cryptographic or testing purposes.

Source

pub fn randomize(&mut self)

Randomizes the digits of this UInt inplace.

This won’t change its BitWidth.

Source

pub fn randomize_using<R>(&mut self, rng: &mut R)
where R: Rng,

Randomizes the digits of this UInt inplace using the given random number generator.

This won’t change its BitWidth.

Source§

impl UInt

Source

pub fn assign(&mut self, rhs: &UInt)

Assigns rhs to this UInt.

This mutates digits and may affect the bitwidth of self which might result in an expensive operations.

After this operation rhs and self are equal to each other.

Source

pub fn strict_assign(&mut self, rhs: &UInt) -> Result<()>

Strictly assigns rhs to this UInt.

After this operation rhs and self are equal to each other.

Note: Strict assigns protect against mutating the bit width of self and thus return an error instead of executing a probably expensive assign operation.

§Errors
  • If rhs and self have unmatching bit widths.
Source§

impl UInt

§Casting: Truncation & Extension

Source

pub fn into_truncate<W>(self, target_width: W) -> Result<UInt>
where W: Into<BitWidth>,

Tries to truncate this UInt inplace to the given target_width and returns the result.

§Note
  • This is useful for method chaining.
  • For more details look into truncate.
§Errors
  • If the target_width is greater than the current width.
Source

pub fn truncate<W>(&mut self, target_width: W) -> Result<()>
where W: Into<BitWidth>,

Tries to truncate this UInt inplace to the given target_width.

§Note
  • This is a no-op if self.width() and target_width are equal.
  • This operation is inplace as long as self.width() and target_width require the same amount of digits for their representation.
§Errors
  • If the target_width is greater than the current width.
Source

pub fn into_extend<W>(self, target_width: W) -> Result<UInt>
where W: Into<BitWidth>,

Tries to zero-extend this UInt inplace to the given target_width and returns the result.

§Note
  • This is useful for method chaining.
  • For more details look into extend.
§Errors
  • If the target_width is less than the current width.
Source

pub fn extend<W>(&mut self, target_width: W) -> Result<()>
where W: Into<BitWidth>,

Tries to extend this UInt inplace to the given target_width.

§Note
  • This is a no-op if self.width() and target_width are equal.
  • This operation is inplace as long as self.width() and target_width require the same amount of digits for their representation.
§Errors
  • If the target_width is less than the current width.
Source

pub fn into_resize<W>(self, target_width: W) -> UInt
where W: Into<BitWidth>,

Resizes this UInt to the given target_width and returns the result.

§Note
  • This is useful for method chaining.
  • For more details look into resize.
Source

pub fn resize<W>(&mut self, target_width: W)
where W: Into<BitWidth>,

Resizes the given UInt inplace.

§Note

This operation will forward to

  • truncate if target_width is less than or equal to the width of the given UInt
  • extend otherwise
Source§

impl UInt

§Bitwise Operations

Source

pub fn into_bitnot(self) -> Self

Flips all bits of self and returns the result.

Source

pub fn bitnot(&mut self)

Flip all bits of this UInt inplace.

Source

pub fn into_checked_bitand(self, rhs: &UInt) -> Result<UInt>

Tries to bit-and assign this UInt inplace to rhs and returns the result.

Note: This forwards to checked_bitand.

§Errors

If self and rhs have unmatching bit widths.

Source

pub fn checked_bitand_assign(&mut self, rhs: &UInt) -> Result<()>

Bit-and assigns all bits of this UInt with the bits of rhs.

Note: This operation is inplace of self and won’t allocate memory.

§Errors

If self and rhs have unmatching bit widths.

Source

pub fn into_checked_bitor(self, rhs: &UInt) -> Result<UInt>

Tries to bit-and assign this UInt inplace to rhs and returns the result.

Note: This forwards to checked_bitor.

§Errors

If self and rhs have unmatching bit widths.

Source

pub fn checked_bitor_assign(&mut self, rhs: &UInt) -> Result<()>

Bit-or assigns all bits of this UInt with the bits of rhs.

Note: This operation is inplace of self and won’t allocate memory.

§Errors

If self and rhs have unmatching bit widths.

Source

pub fn into_checked_bitxor(self, rhs: &UInt) -> Result<UInt>

Tries to bit-xor assign this UInt inplace to rhs and returns the result.

Note: This forwards to checked_bitxor.

§Errors

If self and rhs have unmatching bit widths.

Source

pub fn checked_bitxor_assign(&mut self, rhs: &UInt) -> Result<()>

Bit-xor assigns all bits of this UInt with the bits of rhs.

Note: This operation is inplace of self and won’t allocate memory.

§Errors

If self and rhs have unmatching bit widths.

Source§

impl UInt

§Bitwise Access

Source

pub fn get_bit_at<P>(&self, pos: P) -> Result<Bit>
where P: Into<BitPos>,

Returns the bit at the given bit position pos.

This returns

  • Bit::Set if the bit at pos is 1
  • Bit::Unset otherwise
§Errors
  • If pos is not a valid bit position for the width of this UInt.
Source

pub fn set_bit_at<P>(&mut self, pos: P) -> Result<()>
where P: Into<BitPos>,

Sets the bit at the given bit position pos to one (1).

§Errors
  • If pos is not a valid bit position for the width of this UInt.
Source

pub fn unset_bit_at<P>(&mut self, pos: P) -> Result<()>
where P: Into<BitPos>,

Sets the bit at the given bit position pos to zero (0).

§Errors
  • If pos is not a valid bit position for the width of this UInt.
Source

pub fn flip_bit_at<P>(&mut self, pos: P) -> Result<()>
where P: Into<BitPos>,

Flips the bit at the given bit position pos.

§Note
  • If the bit at the given position was 0 it will be 1 after this operation and vice versa.
§Errors
  • If pos is not a valid bit position for the width of this UInt.
Source

pub fn set_all(&mut self)

Sets all bits of this UInt to one (1).

Source

pub fn is_all_set(&self) -> bool

Returns true if all bits in this UInt are set.

Source

pub fn unset_all(&mut self)

Sets all bits of this UInt to zero (0).

Source

pub fn is_all_unset(&self) -> bool

Returns true if all bits in this UInt are unset.

Source

pub fn flip_all(&mut self)

Flips all bits of this UInt.

Source§

impl UInt

§Bitwise utility methods.

Source

pub fn count_ones(&self) -> usize

Returns the number of ones in the binary representation of this UInt.

Source

pub fn count_zeros(&self) -> usize

Returns the number of zeros in the binary representation of this UInt.

Source

pub fn leading_zeros(&self) -> usize

Returns the number of leading zeros in the binary representation of this UInt.

Source

pub fn trailing_zeros(&self) -> usize

Returns the number of trailing zeros in the binary representation of this UInt.

Source§

impl UInt

§Arithmetic Operations

Source

pub fn into_checked_add(self, rhs: &UInt) -> Result<UInt>

Adds rhs to self and returns the result.

Note: This will not allocate memory.

§Errors
  • If self and rhs have unmatching bit widths.
Source

pub fn checked_add_assign(&mut self, rhs: &UInt) -> Result<()>

Add-assigns rhs to self inplace.

Note: This will not allocate memory.

§Errors
  • If self and rhs have unmatching bit widths.
Source

pub fn into_checked_sub(self, rhs: &UInt) -> Result<UInt>

Subtracts rhs from self and returns the result.

§Note

In the low-level bit-wise representation there is no difference between signed and unsigned subtraction of fixed bit-width integers. (Cite: LLVM)

§Errors
  • If self and rhs have unmatching bit widths.
Source

pub fn checked_sub_assign(&mut self, rhs: &UInt) -> Result<()>

Subtract-assigns rhs from self inplace.

§Note

In the low-level bit-wise representation there is no difference between signed and unsigned subtraction of fixed bit-width integers. (Cite: LLVM)

§Errors
  • If self and rhs have unmatching bit widths.
Source

pub fn into_checked_mul(self, rhs: &UInt) -> Result<UInt>

Subtracts rhs from self and returns the result.

§Note

In the low-level bit-wise representation there is no difference between signed and unsigned multiplication of fixed bit-width integers. (Cite: LLVM)

§Errors
  • If self and rhs have unmatching bit widths.
Source

pub fn checked_mul_assign(&mut self, rhs: &UInt) -> Result<()>

Multiply-assigns rhs to self inplace.

§Note

In the low-level bit-wise representation there is no difference between signed and unsigned multiplication of fixed bit-width integers. (Cite: LLVM)

§Errors
  • If self and rhs have unmatching bit widths.
Source

pub fn into_checked_div(self, rhs: &UInt) -> Result<UInt>

Divides self by rhs and returns the result.

§Note
  • This operation will not allocate memory and computes inplace of self.
  • In the low-level machine abstraction signed division and unsigned division are two different operations.
§Errors
  • If self and rhs have unmatching bit widths.
Source

pub fn checked_div_assign(&mut self, rhs: &UInt) -> Result<()>

Assignes self to the division of self by rhs.

§Note
  • This operation will not allocate memory and computes inplace of self.
  • In the low-level machine abstraction signed division and unsigned division are two different operations.
§Errors
  • If self and rhs have unmatching bit widths.
Source

pub fn into_checked_rem(self, rhs: &UInt) -> Result<UInt>

Calculates the unsigned remainder of self by rhs and returns the result.

§Note
  • This operation will not allocate memory and computes inplace of self.
  • In the low-level machine abstraction signed division and unsigned division are two different operations.
§Errors
  • If self and rhs have unmatching bit widths.
Source

pub fn checked_rem_assign(&mut self, rhs: &UInt) -> Result<()>

Assignes self to the unsigned remainder of self by rhs.

§Note
  • This operation will not allocate memory and computes inplace of self.
  • In the low-level machine abstraction signed division and unsigned division are two different operations.
§Errors
  • If self and rhs have unmatching bit widths.

Trait Implementations§

Source§

impl<'a, 'b> Add<&'a UInt> for &'b UInt

Source§

type Output = UInt

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &'a UInt) -> Self::Output

Performs the + operation. Read more
Source§

impl<'a> Add<&'a UInt> for UInt

Source§

type Output = UInt

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &'a UInt) -> Self::Output

Performs the + operation. Read more
Source§

impl<'a> AddAssign<&'a UInt> for UInt

Source§

fn add_assign(&mut self, rhs: &'a UInt)

Performs the += operation. Read more
Source§

impl Binary for UInt

Source§

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

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

impl<'a, 'b> BitAnd<&'a UInt> for &'b UInt

Source§

type Output = UInt

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: &'a UInt) -> Self::Output

Performs the & operation. Read more
Source§

impl<'a, 'b> BitAnd<&'a UInt> for &'b mut UInt

Source§

type Output = UInt

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: &'a UInt) -> Self::Output

Performs the & operation. Read more
Source§

impl<'a> BitAnd<&'a UInt> for UInt

Source§

type Output = UInt

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: &'a UInt) -> Self::Output

Performs the & operation. Read more
Source§

impl<'a> BitAndAssign<&'a UInt> for UInt

Source§

fn bitand_assign(&mut self, rhs: &'a UInt)

Performs the &= operation. Read more
Source§

impl<'a, 'b> BitOr<&'a UInt> for &'b UInt

Source§

type Output = UInt

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: &'a UInt) -> Self::Output

Performs the | operation. Read more
Source§

impl<'a, 'b> BitOr<&'a UInt> for &'b mut UInt

Source§

type Output = UInt

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: &'a UInt) -> Self::Output

Performs the | operation. Read more
Source§

impl<'a> BitOr<&'a UInt> for UInt

Source§

type Output = UInt

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: &'a UInt) -> Self::Output

Performs the | operation. Read more
Source§

impl<'a> BitOrAssign<&'a UInt> for UInt

Source§

fn bitor_assign(&mut self, rhs: &'a UInt)

Performs the |= operation. Read more
Source§

impl<'a, 'b> BitXor<&'a UInt> for &'b UInt

Source§

type Output = UInt

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, rhs: &'a UInt) -> Self::Output

Performs the ^ operation. Read more
Source§

impl<'a, 'b> BitXor<&'a UInt> for &'b mut UInt

Source§

type Output = UInt

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, rhs: &'a UInt) -> Self::Output

Performs the ^ operation. Read more
Source§

impl<'a> BitXor<&'a UInt> for UInt

Source§

type Output = UInt

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, rhs: &'a UInt) -> Self::Output

Performs the ^ operation. Read more
Source§

impl<'a> BitXorAssign<&'a UInt> for UInt

Source§

fn bitxor_assign(&mut self, rhs: &'a UInt)

Performs the ^= operation. Read more
Source§

impl Clone for UInt

Source§

fn clone(&self) -> UInt

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 Debug for UInt

Source§

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

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

impl<'de> Deserialize<'de> for UInt

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<'a, 'b> Div<&'a UInt> for &'b UInt

Source§

type Output = UInt

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &'a UInt) -> Self::Output

Performs the / operation. Read more
Source§

impl<'a> Div<&'a UInt> for UInt

Source§

type Output = UInt

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &'a UInt) -> Self::Output

Performs the / operation. Read more
Source§

impl<'a> DivAssign<&'a UInt> for UInt

Source§

fn div_assign(&mut self, rhs: &'a UInt)

Performs the /= operation. Read more
Source§

impl From<[u64; 16]> for UInt

Source§

fn from(val: [u64; 16]) -> UInt

Converts to this type from the input type.
Source§

impl From<[u64; 2]> for UInt

Source§

fn from(val: [u64; 2]) -> UInt

Converts to this type from the input type.
Source§

impl From<[u64; 3]> for UInt

Source§

fn from(val: [u64; 3]) -> UInt

Converts to this type from the input type.
Source§

impl From<[u64; 32]> for UInt

Source§

fn from(val: [u64; 32]) -> UInt

Converts to this type from the input type.
Source§

impl From<[u64; 4]> for UInt

Source§

fn from(val: [u64; 4]) -> UInt

Converts to this type from the input type.
Source§

impl From<[u64; 5]> for UInt

Source§

fn from(val: [u64; 5]) -> UInt

Converts to this type from the input type.
Source§

impl From<[u64; 6]> for UInt

Source§

fn from(val: [u64; 6]) -> UInt

Converts to this type from the input type.
Source§

impl From<[u64; 7]> for UInt

Source§

fn from(val: [u64; 7]) -> UInt

Converts to this type from the input type.
Source§

impl From<[u64; 8]> for UInt

Source§

fn from(val: [u64; 8]) -> UInt

Converts to this type from the input type.
Source§

impl From<ApInt> for UInt

Source§

fn from(value: ApInt) -> UInt

Converts to this type from the input type.
Source§

impl<B> From<B> for UInt
where B: Into<Bit>,

Source§

fn from(bit: B) -> UInt

Converts to this type from the input type.
Source§

impl From<u128> for UInt

Source§

fn from(val: u128) -> UInt

Converts to this type from the input type.
Source§

impl From<u16> for UInt

Source§

fn from(val: u16) -> UInt

Converts to this type from the input type.
Source§

impl From<u32> for UInt

Source§

fn from(val: u32) -> UInt

Converts to this type from the input type.
Source§

impl From<u64> for UInt

Source§

fn from(val: u64) -> UInt

Converts to this type from the input type.
Source§

impl From<u8> for UInt

Source§

fn from(val: u8) -> UInt

Converts to this type from the input type.
Source§

impl Hash for UInt

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 LowerHex for UInt

Source§

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

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

impl<'a, 'b> Mul<&'a UInt> for &'b UInt

Source§

type Output = UInt

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &'a UInt) -> Self::Output

Performs the * operation. Read more
Source§

impl<'a> Mul<&'a UInt> for UInt

Source§

type Output = UInt

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &'a UInt) -> Self::Output

Performs the * operation. Read more
Source§

impl<'a> MulAssign<&'a UInt> for UInt

Source§

fn mul_assign(&mut self, rhs: &'a UInt)

Performs the *= operation. Read more
Source§

impl Not for UInt

Source§

type Output = UInt

The resulting type after applying the ! operator.
Source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
Source§

impl Octal for UInt

Source§

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

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

impl PartialEq for UInt

Source§

fn eq(&self, other: &UInt) -> 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 PartialOrd for UInt

Source§

fn partial_cmp(&self, rhs: &UInt) -> Option<Ordering>

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

fn lt(&self, rhs: &UInt) -> bool

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

fn le(&self, rhs: &UInt) -> bool

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

fn gt(&self, rhs: &UInt) -> bool

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

fn ge(&self, rhs: &UInt) -> bool

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

impl<'a, 'b> Rem<&'a UInt> for &'b UInt

Source§

type Output = UInt

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: &'a UInt) -> Self::Output

Performs the % operation. Read more
Source§

impl<'a> Rem<&'a UInt> for UInt

Source§

type Output = UInt

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: &'a UInt) -> Self::Output

Performs the % operation. Read more
Source§

impl<'a> RemAssign<&'a UInt> for UInt

Source§

fn rem_assign(&mut self, rhs: &'a UInt)

Performs the %= operation. Read more
Source§

impl Serialize for UInt

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<S> Shl<S> for UInt
where S: Into<ShiftAmount>,

Source§

type Output = UInt

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

fn shl(self, shift_amount: S) -> Self::Output

Performs the << operation. Read more
Source§

impl<S> ShlAssign<S> for UInt
where S: Into<ShiftAmount>,

Source§

fn shl_assign(&mut self, shift_amount: S)

Performs the <<= operation. Read more
Source§

impl<S> Shr<S> for UInt
where S: Into<ShiftAmount>,

Source§

type Output = UInt

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

fn shr(self, shift_amount: S) -> Self::Output

Performs the >> operation. Read more
Source§

impl<S> ShrAssign<S> for UInt
where S: Into<ShiftAmount>,

Source§

fn shr_assign(&mut self, shift_amount: S)

Performs the >>= operation. Read more
Source§

impl<'a, 'b> Sub<&'a UInt> for &'b UInt

Source§

type Output = UInt

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &'a UInt) -> Self::Output

Performs the - operation. Read more
Source§

impl<'a> Sub<&'a UInt> for UInt

Source§

type Output = UInt

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &'a UInt) -> Self::Output

Performs the - operation. Read more
Source§

impl<'a> SubAssign<&'a UInt> for UInt

Source§

fn sub_assign(&mut self, rhs: &'a UInt)

Performs the -= operation. Read more
Source§

impl UpperHex for UInt

Source§

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

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

impl Eq for UInt

Source§

impl StructuralPartialEq for UInt

Auto Trait Implementations§

§

impl Freeze for UInt

§

impl RefUnwindSafe for UInt

§

impl Send for UInt

§

impl Sync for UInt

§

impl Unpin for UInt

§

impl UnwindSafe for UInt

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

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

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,