Unsigned5Bit

Struct Unsigned5Bit 

Source
pub struct Unsigned5Bit {
    pub(crate) bits: u8,
}
Expand description

Unsigned5Bit is used as a system configuration value; that is, an index into F-memory.

Fields§

§bits: u8

Implementations§

Source§

impl Unsigned5Bit

Source

const MODULUS: u8 = 32u8

Source

const VALUE_BITS: u8 = 31u8

Source

pub const MAX: Self

Source

pub const ZERO: Self

Source

pub const ONE: Self

Source

pub const MIN: Self = Self::ZERO

Source

pub const fn new<const N: u8>() -> Unsigned5Bit

Source

pub const fn is_zero(&self) -> bool

Source

pub const fn is_negative(&self) -> bool

Source

pub const fn is_positive(&self) -> bool

Source

pub const fn reinterpret_as_signed(&self) -> Signed5Bit

Source

pub fn wrapping_add(self, rhs: Unsigned5Bit) -> Unsigned5Bit

Source

pub fn wrapping_sub(self, rhs: Unsigned5Bit) -> Unsigned5Bit

Source

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

Source

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

Source

pub fn wrapping_mul(self, rhs: Unsigned5Bit) -> Unsigned5Bit

Source

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

Source

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

Source

pub const fn abs(self) -> Self

Source

pub const fn overflowing_abs(self) -> (Self, bool)

Source

pub const fn and(self, mask: u8) -> Self

Source

pub const fn bitor(self, mask: u8) -> Self

Trait Implementations§

Source§

impl BitAnd<u8> for Unsigned5Bit

Source§

type Output = Unsigned5Bit

The resulting type after applying the & operator.
Source§

fn bitand(self, mask: u8) -> Self

Performs the & operation. Read more
Source§

impl BitAnd for Unsigned5Bit

Source§

type Output = Unsigned5Bit

The resulting type after applying the & operator.
Source§

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

Performs the & operation. Read more
Source§

impl BitOr<u8> for Unsigned5Bit

Source§

type Output = Unsigned5Bit

The resulting type after applying the | operator.
Source§

fn bitor(self, mask: u8) -> Self

Performs the | operation. Read more
Source§

impl BitOr for Unsigned5Bit

Source§

type Output = Unsigned5Bit

The resulting type after applying the | operator.
Source§

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

Performs the | operation. Read more
Source§

impl BitXor<u8> for Unsigned5Bit

Source§

type Output = Unsigned5Bit

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, mask: u8) -> Self

Performs the ^ operation. Read more
Source§

impl BitXor for Unsigned5Bit

Source§

type Output = Unsigned5Bit

The resulting type after applying the ^ operator.
Source§

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

Performs the ^ operation. Read more
Source§

impl Clone for Unsigned5Bit

Source§

fn clone(&self) -> Unsigned5Bit

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 Unsigned5Bit

Source§

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

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

impl Default for Unsigned5Bit

Source§

fn default() -> Self

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

impl Display for Unsigned5Bit

Source§

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

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

impl From<Unsigned5Bit> for Unsigned12Bit

Source§

fn from(n: Unsigned5Bit) -> Self

Converts to this type from the input type.
Source§

impl From<Unsigned5Bit> for Unsigned18Bit

Source§

fn from(n: Unsigned5Bit) -> Self

Converts to this type from the input type.
Source§

impl From<Unsigned5Bit> for Unsigned36Bit

Source§

fn from(n: Unsigned5Bit) -> Self

Converts to this type from the input type.
Source§

impl From<Unsigned5Bit> for Unsigned6Bit

Source§

fn from(n: Unsigned5Bit) -> Self

Converts to this type from the input type.
Source§

impl From<Unsigned5Bit> for Unsigned9Bit

Source§

fn from(n: Unsigned5Bit) -> Self

Converts to this type from the input type.
Source§

impl From<Unsigned5Bit> for i16

Source§

fn from(n: Unsigned5Bit) -> i16

Converts to this type from the input type.
Source§

impl From<Unsigned5Bit> for i32

Source§

fn from(n: Unsigned5Bit) -> i32

Converts to this type from the input type.
Source§

impl From<Unsigned5Bit> for i64

Source§

fn from(n: Unsigned5Bit) -> i64

Converts to this type from the input type.
Source§

impl From<Unsigned5Bit> for i8

Source§

fn from(n: Unsigned5Bit) -> i8

Converts to this type from the input type.
Source§

impl From<Unsigned5Bit> for isize

Source§

fn from(n: Unsigned5Bit) -> isize

Converts to this type from the input type.
Source§

impl From<Unsigned5Bit> for u16

Source§

fn from(n: Unsigned5Bit) -> u16

Converts to this type from the input type.
Source§

impl From<Unsigned5Bit> for u32

Source§

fn from(n: Unsigned5Bit) -> u32

Converts to this type from the input type.
Source§

impl From<Unsigned5Bit> for u64

Source§

fn from(n: Unsigned5Bit) -> u64

Converts to this type from the input type.
Source§

impl From<Unsigned5Bit> for u8

Source§

fn from(n: Unsigned5Bit) -> u8

Converts to this type from the input type.
Source§

impl From<Unsigned5Bit> for usize

Source§

fn from(n: Unsigned5Bit) -> usize

Converts to this type from the input type.
Source§

impl Hash for Unsigned5Bit

Source§

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

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 Not for Unsigned5Bit

Source§

type Output = Unsigned5Bit

The resulting type after applying the ! operator.
Source§

fn not(self) -> Self

Performs the unary ! operation. Read more
Source§

impl Octal for Unsigned5Bit

Source§

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

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

impl Ord for Unsigned5Bit

Source§

fn cmp(&self, other: &Unsigned5Bit) -> 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<T> for Unsigned5Bit

Source§

fn eq(&self, other: &T) -> 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<u32> for Unsigned5Bit

Source§

fn partial_cmp(&self, other: &u32) -> 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 PartialOrd<u64> for Unsigned5Bit

Source§

fn partial_cmp(&self, other: &u64) -> 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 PartialOrd for Unsigned5Bit

Source§

fn partial_cmp(&self, other: &Unsigned5Bit) -> 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 Serialize for Unsigned5Bit

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 Shl<u32> for Unsigned5Bit

Source§

type Output = Unsigned5Bit

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

fn shl(self, rhs: u32) -> Self

Performs the << operation. Read more
Source§

impl Shl for Unsigned5Bit

Source§

type Output = Unsigned5Bit

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

fn shl(self, shift_by: Unsigned5Bit) -> Self

Performs the << operation. Read more
Source§

impl Shr<u32> for Unsigned5Bit

Source§

type Output = Unsigned5Bit

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

fn shr(self, shift_by: u32) -> Self

Performs the >> operation. Read more
Source§

impl Shr for Unsigned5Bit

Source§

type Output = Unsigned5Bit

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

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

Performs the >> operation. Read more
Source§

impl Sum for Unsigned5Bit

Source§

fn sum<I: Iterator<Item = Self>>(iter: I) -> Self

Takes an iterator and generates Self from the elements by “summing up” the items.
Source§

impl TryFrom<i16> for Unsigned5Bit

Source§

type Error = ConversionFailed

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

fn try_from(n: i16) -> Result<Self, ConversionFailed>

Performs the conversion.
Source§

impl TryFrom<i32> for Unsigned5Bit

Source§

type Error = ConversionFailed

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

fn try_from(n: i32) -> Result<Self, ConversionFailed>

Performs the conversion.
Source§

impl TryFrom<i64> for Unsigned5Bit

Source§

type Error = ConversionFailed

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

fn try_from(n: i64) -> Result<Self, ConversionFailed>

Performs the conversion.
Source§

impl TryFrom<i8> for Unsigned5Bit

Source§

type Error = ConversionFailed

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

fn try_from(n: i8) -> Result<Self, ConversionFailed>

Performs the conversion.
Source§

impl TryFrom<isize> for Unsigned5Bit

Source§

type Error = ConversionFailed

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

fn try_from(n: isize) -> Result<Self, ConversionFailed>

Performs the conversion.
Source§

impl TryFrom<u16> for Unsigned5Bit

Source§

type Error = ConversionFailed

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

fn try_from(n: u16) -> Result<Self, ConversionFailed>

Performs the conversion.
Source§

impl TryFrom<u32> for Unsigned5Bit

Source§

type Error = ConversionFailed

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

fn try_from(n: u32) -> Result<Self, ConversionFailed>

Performs the conversion.
Source§

impl TryFrom<u64> for Unsigned5Bit

Source§

type Error = ConversionFailed

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

fn try_from(n: u64) -> Result<Self, ConversionFailed>

Performs the conversion.
Source§

impl TryFrom<u8> for Unsigned5Bit

Source§

type Error = ConversionFailed

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

fn try_from(n: u8) -> Result<Self, ConversionFailed>

Performs the conversion.
Source§

impl TryFrom<usize> for Unsigned5Bit

Source§

type Error = ConversionFailed

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

fn try_from(n: usize) -> Result<Self, ConversionFailed>

Performs the conversion.
Source§

impl WordCommon for Unsigned5Bit

Source§

fn signum(&self) -> Signum

Source§

impl Copy for Unsigned5Bit

Source§

impl Eq for Unsigned5Bit

Auto Trait Implementations§

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
§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.