Struct amplify_num::u5[][src]

pub struct u5(_);
Expand description

5-bit unsigned integer in the range 0..32

Implementations

impl u5[src]

pub const BITS: u32[src]

Bit dimension

pub const MIN: Self[src]

Minimum value

pub const MAX: Self[src]

Maximal value

pub const ONE: Self[src]

One value

pub const ZERO: Self[src]

One value

pub fn with(value: u8) -> Self[src]

Creates a new value from a provided `value.

Panics if the value exceeds Self::MAX

pub fn as_u8(self) -> u8[src]

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

impl u5[src]

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

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

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

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

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

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.

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

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

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

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

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

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

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

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.

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

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

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

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

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

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

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

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.

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

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

Trait Implementations

impl<T> Add<T> for u5 where
    T: Into<u8>, 
[src]

type Output = u5

The resulting type after applying the + operator.

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

Performs the + operation. Read more

impl<T> Add<T> for &u5 where
    T: Into<u8>, 
[src]

type Output = u5

The resulting type after applying the + operator.

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

Performs the + operation. Read more

impl<T> AddAssign<T> for u5 where
    T: Into<u8>, 
[src]

fn add_assign(&mut self, rhs: T)[src]

Performs the += operation. Read more

impl AsRef<u8> for u5[src]

fn as_ref(&self) -> &u8[src]

Performs the conversion.

impl<T> BitAnd<T> for u5 where
    T: Into<u8>, 
[src]

type Output = u5

The resulting type after applying the & operator.

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

Performs the & operation. Read more

impl<T> BitAnd<T> for &u5 where
    T: Into<u8>, 
[src]

type Output = u5

The resulting type after applying the & operator.

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

Performs the & operation. Read more

impl<T> BitAndAssign<T> for u5 where
    T: Into<u8>, 
[src]

fn bitand_assign(&mut self, rhs: T)[src]

Performs the &= operation. Read more

impl<T> BitOr<T> for u5 where
    T: Into<u8>, 
[src]

type Output = u5

The resulting type after applying the | operator.

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

Performs the | operation. Read more

impl<T> BitOr<T> for &u5 where
    T: Into<u8>, 
[src]

type Output = u5

The resulting type after applying the | operator.

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

Performs the | operation. Read more

impl<T> BitOrAssign<T> for u5 where
    T: Into<u8>, 
[src]

fn bitor_assign(&mut self, rhs: T)[src]

Performs the |= operation. Read more

impl<T> BitXor<T> for u5 where
    T: Into<u8>, 
[src]

type Output = u5

The resulting type after applying the ^ operator.

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

Performs the ^ operation. Read more

impl<T> BitXor<T> for &u5 where
    T: Into<u8>, 
[src]

type Output = u5

The resulting type after applying the ^ operator.

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

Performs the ^ operation. Read more

impl<T> BitXorAssign<T> for u5 where
    T: Into<u8>, 
[src]

fn bitxor_assign(&mut self, rhs: T)[src]

Performs the ^= operation. Read more

impl Clone for u5[src]

fn clone(&self) -> u5[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for u5[src]

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

Formats the value using the given formatter. Read more

impl Default for u5[src]

fn default() -> u5[src]

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

impl Display for u5[src]

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

Formats the value using the given formatter. Read more

impl<T> Div<T> for u5 where
    T: Into<u8>, 
[src]

type Output = u5

The resulting type after applying the / operator.

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

Performs the / operation. Read more

impl<T> Div<T> for &u5 where
    T: Into<u8>, 
[src]

type Output = u5

The resulting type after applying the / operator.

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

Performs the / operation. Read more

impl<T> DivAssign<T> for u5 where
    T: Into<u8>, 
[src]

fn div_assign(&mut self, rhs: T)[src]

Performs the /= operation. Read more

impl FromStr for u5[src]

type Err = ParseIntError

The associated error which can be returned from parsing.

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

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

impl Hash for u5[src]

fn hash<__H: Hasher>(&self, state: &mut __H)[src]

Feeds this value into the given Hasher. Read more

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

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

impl<T> Mul<T> for u5 where
    T: Into<u8>, 
[src]

type Output = u5

The resulting type after applying the * operator.

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

Performs the * operation. Read more

impl<T> Mul<T> for &u5 where
    T: Into<u8>, 
[src]

type Output = u5

The resulting type after applying the * operator.

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

Performs the * operation. Read more

impl<T> MulAssign<T> for u5 where
    T: Into<u8>, 
[src]

fn mul_assign(&mut self, rhs: T)[src]

Performs the *= operation. Read more

impl Ord for u5[src]

fn cmp(&self, other: &u5) -> Ordering[src]

This method returns an Ordering between self and other. Read more

#[must_use]
fn max(self, other: Self) -> Self
1.21.0[src]

Compares and returns the maximum of two values. Read more

#[must_use]
fn min(self, other: Self) -> Self
1.21.0[src]

Compares and returns the minimum of two values. Read more

#[must_use]
fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]

Restrict a value to a certain interval. Read more

impl PartialEq<u5> for u5[src]

fn eq(&self, other: &u5) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &u5) -> bool[src]

This method tests for !=.

impl PartialOrd<u5> for u5[src]

fn partial_cmp(&self, other: &u5) -> Option<Ordering>[src]

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

#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]

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

#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]

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

#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]

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

#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]

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

impl<T> Rem<T> for u5 where
    T: Into<u8>, 
[src]

type Output = u5

The resulting type after applying the % operator.

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

Performs the % operation. Read more

impl<T> Rem<T> for &u5 where
    T: Into<u8>, 
[src]

type Output = u5

The resulting type after applying the % operator.

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

Performs the % operation. Read more

impl<T> RemAssign<T> for u5 where
    T: Into<u8>, 
[src]

fn rem_assign(&mut self, rhs: T)[src]

Performs the %= operation. Read more

impl<T> Shl<T> for u5 where
    T: Into<u8>, 
[src]

type Output = u5

The resulting type after applying the << operator.

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

Performs the << operation. Read more

impl<T> Shl<T> for &u5 where
    T: Into<u8>, 
[src]

type Output = u5

The resulting type after applying the << operator.

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

Performs the << operation. Read more

impl<T> ShlAssign<T> for u5 where
    T: Into<u8>, 
[src]

fn shl_assign(&mut self, rhs: T)[src]

Performs the <<= operation. Read more

impl<T> Shr<T> for u5 where
    T: Into<u8>, 
[src]

type Output = u5

The resulting type after applying the >> operator.

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

Performs the >> operation. Read more

impl<T> Shr<T> for &u5 where
    T: Into<u8>, 
[src]

type Output = u5

The resulting type after applying the >> operator.

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

Performs the >> operation. Read more

impl<T> ShrAssign<T> for u5 where
    T: Into<u8>, 
[src]

fn shr_assign(&mut self, rhs: T)[src]

Performs the >>= operation. Read more

impl<T> Sub<T> for u5 where
    T: Into<u8>, 
[src]

type Output = u5

The resulting type after applying the - operator.

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

Performs the - operation. Read more

impl<T> Sub<T> for &u5 where
    T: Into<u8>, 
[src]

type Output = u5

The resulting type after applying the - operator.

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

Performs the - operation. Read more

impl<T> SubAssign<T> for u5 where
    T: Into<u8>, 
[src]

fn sub_assign(&mut self, rhs: T)[src]

Performs the -= operation. Read more

impl TryFrom<u8> for u5[src]

type Error = OverflowError

The type returned in the event of a conversion error.

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

Performs the conversion.

impl Copy for u5[src]

impl Eq for u5[src]

impl StructuralEq for u5[src]

impl StructuralPartialEq for u5[src]

Auto Trait Implementations

impl Send for u5

impl Sync for u5

impl Unpin for u5

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

Performs the conversion.