Struct amplify_num::u6

source ·
pub struct u6(/* private fields */);
Expand description

6-bit unsigned integer in the range 0..64

Implementations§

source§

impl u6

source

pub const BITS: u32 = 6u32

Bit dimension

source

pub const MIN: Self = _

Minimum value

source

pub const MAX: Self = _

Maximal value

source

pub const ONE: Self = _

One value

source

pub const ZERO: Self = _

One value

source

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

Creates a new value from a provided `value.

Panics if the value exceeds Self::MAX

source

pub const fn to_u8(&self) -> u8

Returns inner u8 representation, which is always less or equal to Self::MAX

source

pub const fn into_u8(self) -> u8

Returns inner u8 representation, which is always less or equal to Self::MAX

source§

impl u6

source

pub fn checked_add<T>(self, rhs: T) -> Option<Self>
where T: Into<u8>,

Checked integer addition. Computes self + rhs, returning None if overflow occurred.

source

pub fn saturating_add<T>(self, rhs: T) -> Self
where T: Into<u8>,

Saturating integer addition. Computes self + rhs, saturating at the numeric bounds instead of overflowing.

source

pub fn overflowing_add<T>(self, rhs: T) -> (Self, bool)
where T: Into<u8>,

Calculates self + rhs

Returns a tuple of the addition along with a boolean indicating whether an arithmetic overflow would occur. If an overflow would have occurred then the wrapped value is returned.

source

pub fn wrapping_add<T>(self, rhs: T) -> Self
where T: Into<u8>,

Wrapping (modular) addition. Computes self + rhs, wrapping around at the boundary of the type.

source

pub fn checked_sub<T>(self, rhs: T) -> Option<Self>
where T: Into<u8>,

Checked integer subtraction. Computes self - rhs, returning None if overflow occurred.

source

pub fn saturating_sub<T>(self, rhs: T) -> Self
where T: Into<u8>,

Saturating integer subtraction. Computes self - rhs, saturating at the numeric bounds instead of overflowing.

source

pub fn overflowing_sub<T>(self, rhs: T) -> (Self, bool)
where T: Into<u8>,

Calculates self - rhs

Returns a tuple of the subtraction along with a boolean indicating whether an arithmetic overflow would occur. If an overflow would have occurred then the wrapped value is returned.

source

pub fn wrapping_sub<T>(self, rhs: T) -> Self
where T: Into<u8>,

Wrapping (modular) subtraction. Computes self - rhs, wrapping around at the boundary of the type.

source

pub fn checked_mul<T>(self, rhs: T) -> Option<Self>
where T: Into<u8>,

Checked integer multiplication. Computes self * rhs, returning None if overflow occurred.

source

pub fn saturating_mul<T>(self, rhs: T) -> Self
where T: Into<u8>,

Saturating integer multiplication. Computes self * rhs, saturating at the numeric bounds instead of overflowing.

source

pub fn overflowing_mul<T>(self, rhs: T) -> (Self, bool)
where T: Into<u8>,

Calculates self * rhs

Returns a tuple of the multiplication along with a boolean indicating whether an arithmetic overflow would occur. If an overflow would have occurred then the wrapped value is returned.

source

pub fn wrapping_mul<T>(self, rhs: T) -> Self
where T: Into<u8>,

Wrapping (modular) multiplication. Computes self * rhs, wrapping around at the boundary of the type.

source

pub fn div_rem(self, other: Self) -> Result<(Self, Self), DivError>

Trait Implementations§

source§

impl<T> Add<T> for &u6
where T: Into<u8>,

§

type Output = u6

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl<T> Add<T> for u6
where T: Into<u8>,

§

type Output = u6

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl<T> AddAssign<T> for u6
where T: Into<u8>,

source§

fn add_assign(&mut self, rhs: T)

Performs the += operation. Read more
source§

impl AsRef<u8> for u6

source§

fn as_ref(&self) -> &u8

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl Binary for u6

source§

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

Formats the value using the given formatter.
source§

impl<T> BitAnd<T> for &u6
where T: Into<u8>,

§

type Output = u6

The resulting type after applying the & operator.
source§

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

Performs the & operation. Read more
source§

impl<T> BitAnd<T> for u6
where T: Into<u8>,

§

type Output = u6

The resulting type after applying the & operator.
source§

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

Performs the & operation. Read more
source§

impl<T> BitAndAssign<T> for u6
where T: Into<u8>,

source§

fn bitand_assign(&mut self, rhs: T)

Performs the &= operation. Read more
source§

impl<T> BitOr<T> for &u6
where T: Into<u8>,

§

type Output = u6

The resulting type after applying the | operator.
source§

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

Performs the | operation. Read more
source§

impl<T> BitOr<T> for u6
where T: Into<u8>,

§

type Output = u6

The resulting type after applying the | operator.
source§

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

Performs the | operation. Read more
source§

impl<T> BitOrAssign<T> for u6
where T: Into<u8>,

source§

fn bitor_assign(&mut self, rhs: T)

Performs the |= operation. Read more
source§

impl<T> BitXor<T> for &u6
where T: Into<u8>,

§

type Output = u6

The resulting type after applying the ^ operator.
source§

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

Performs the ^ operation. Read more
source§

impl<T> BitXor<T> for u6
where T: Into<u8>,

§

type Output = u6

The resulting type after applying the ^ operator.
source§

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

Performs the ^ operation. Read more
source§

impl<T> BitXorAssign<T> for u6
where T: Into<u8>,

source§

fn bitxor_assign(&mut self, rhs: T)

Performs the ^= operation. Read more
source§

impl Clone for u6

source§

fn clone(&self) -> u6

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for u6

source§

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

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

impl Default for u6

source§

fn default() -> u6

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

impl Display for u6

source§

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

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

impl<T> Div<T> for &u6
where T: Into<u8>,

§

type Output = u6

The resulting type after applying the / operator.
source§

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

Performs the / operation. Read more
source§

impl<T> Div<T> for u6
where T: Into<u8>,

§

type Output = u6

The resulting type after applying the / operator.
source§

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

Performs the / operation. Read more
source§

impl<T> DivAssign<T> for u6
where T: Into<u8>,

source§

fn div_assign(&mut self, rhs: T)

Performs the /= operation. Read more
source§

impl From<u1> for u6

source§

fn from(value: u1) -> Self

Converts to this type from the input type.
source§

impl From<u2> for u6

source§

fn from(value: u2) -> Self

Converts to this type from the input type.
source§

impl From<u3> for u6

source§

fn from(value: u3) -> Self

Converts to this type from the input type.
source§

impl From<u4> for u6

source§

fn from(value: u4) -> Self

Converts to this type from the input type.
source§

impl From<u5> for u6

source§

fn from(value: u5) -> Self

Converts to this type from the input type.
source§

impl From<u6> for u7

source§

fn from(value: u6) -> Self

Converts to this type from the input type.
source§

impl From<u6> for u8

source§

fn from(val: u6) -> Self

Converts to this type from the input type.
source§

impl FromStr for u6

§

type Err = ParseIntError

The associated error which can be returned from parsing.
source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
source§

impl Hash for u6

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 u6

source§

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

Formats the value using the given formatter.
source§

impl<T> Mul<T> for &u6
where T: Into<u8>,

§

type Output = u6

The resulting type after applying the * operator.
source§

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

Performs the * operation. Read more
source§

impl<T> Mul<T> for u6
where T: Into<u8>,

§

type Output = u6

The resulting type after applying the * operator.
source§

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

Performs the * operation. Read more
source§

impl<T> MulAssign<T> for u6
where T: Into<u8>,

source§

fn mul_assign(&mut self, rhs: T)

Performs the *= operation. Read more
source§

impl Octal for u6

source§

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

Formats the value using the given formatter.
source§

impl Ord for u6

source§

fn cmp(&self, other: &u6) -> 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 + PartialOrd,

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

impl PartialEq for u6

source§

fn eq(&self, other: &u6) -> bool

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

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

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

impl PartialOrd for u6

source§

fn partial_cmp(&self, other: &u6) -> Option<Ordering>

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

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

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

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

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

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

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

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

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

impl<T> Rem<T> for &u6
where T: Into<u8>,

§

type Output = u6

The resulting type after applying the % operator.
source§

fn rem(self, rhs: T) -> Self::Output

Performs the % operation. Read more
source§

impl<T> Rem<T> for u6
where T: Into<u8>,

§

type Output = u6

The resulting type after applying the % operator.
source§

fn rem(self, rhs: T) -> Self::Output

Performs the % operation. Read more
source§

impl<T> RemAssign<T> for u6
where T: Into<u8>,

source§

fn rem_assign(&mut self, rhs: T)

Performs the %= operation. Read more
source§

impl<T> Shl<T> for &u6
where T: Into<u8>,

§

type Output = u6

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

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

Performs the << operation. Read more
source§

impl<T> Shl<T> for u6
where T: Into<u8>,

§

type Output = u6

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

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

Performs the << operation. Read more
source§

impl<T> ShlAssign<T> for u6
where T: Into<u8>,

source§

fn shl_assign(&mut self, rhs: T)

Performs the <<= operation. Read more
source§

impl<T> Shr<T> for &u6
where T: Into<u8>,

§

type Output = u6

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

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

Performs the >> operation. Read more
source§

impl<T> Shr<T> for u6
where T: Into<u8>,

§

type Output = u6

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

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

Performs the >> operation. Read more
source§

impl<T> ShrAssign<T> for u6
where T: Into<u8>,

source§

fn shr_assign(&mut self, rhs: T)

Performs the >>= operation. Read more
source§

impl<T> Sub<T> for &u6
where T: Into<u8>,

§

type Output = u6

The resulting type after applying the - operator.
source§

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

Performs the - operation. Read more
source§

impl<T> Sub<T> for u6
where T: Into<u8>,

§

type Output = u6

The resulting type after applying the - operator.
source§

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

Performs the - operation. Read more
source§

impl<T> SubAssign<T> for u6
where T: Into<u8>,

source§

fn sub_assign(&mut self, rhs: T)

Performs the -= operation. Read more
source§

impl TryFrom<u8> for u6

§

type Error = OverflowError<u8>

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

fn try_from(value: u8) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl UpperHex for u6

source§

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

Formats the value using the given formatter.
source§

impl Copy for u6

source§

impl Eq for u6

source§

impl StructuralPartialEq for u6

Auto Trait Implementations§

§

impl RefUnwindSafe for u6

§

impl Send for u6

§

impl Sync for u6

§

impl Unpin for u6

§

impl UnwindSafe for u6

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> 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>,

§

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>,

§

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.