Struct u2

Source
pub struct u2(pub i8);
Expand description

The 2-bit unsigned integer type.

Tuple Fields§

§0: i8

Implementations§

Source§

impl u2

Source

pub const MAX: Self

Source

pub const MIN: Self

Source§

impl u2

Source

pub fn min_value() -> u2

Source

pub fn max_value() -> u2

Source

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

Source

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

Methods from Deref<Target = i8>§

1.43.0 · Source

pub const MIN: i8 = -128i8

1.43.0 · Source

pub const MAX: i8 = 127i8

1.53.0 · Source

pub const BITS: u32 = 8u32

Trait Implementations§

Source§

impl Add for u2

Source§

type Output = u2

The resulting type after applying the + operator.
Source§

fn add(self, other: u2) -> u2

Performs the + operation. Read more
Source§

impl Binary for u2

Source§

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

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

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

Source§

type Output = <u2 as BitOr>::Output

The resulting type after applying the & operator.
Source§

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

Performs the & operation. Read more
Source§

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

Source§

type Output = <u2 as BitOr>::Output

The resulting type after applying the & operator.
Source§

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

Performs the & operation. Read more
Source§

impl<'a> BitAnd for &'a u2

Source§

type Output = <u2 as BitOr>::Output

The resulting type after applying the & operator.
Source§

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

Performs the & operation. Read more
Source§

impl BitAnd for u2

Source§

type Output = u2

The resulting type after applying the & operator.
Source§

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

Performs the & operation. Read more
Source§

impl BitAndAssign for u2

Source§

fn bitand_assign(&mut self, other: u2)

Performs the &= operation. Read more
Source§

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

Source§

type Output = <u2 as BitOr>::Output

The resulting type after applying the | operator.
Source§

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

Performs the | operation. Read more
Source§

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

Source§

type Output = <u2 as BitOr>::Output

The resulting type after applying the | operator.
Source§

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

Performs the | operation. Read more
Source§

impl<'a> BitOr for &'a u2

Source§

type Output = <u2 as BitOr>::Output

The resulting type after applying the | operator.
Source§

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

Performs the | operation. Read more
Source§

impl BitOr for u2

Source§

type Output = u2

The resulting type after applying the | operator.
Source§

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

Performs the | operation. Read more
Source§

impl BitOrAssign for u2

Source§

fn bitor_assign(&mut self, other: u2)

Performs the |= operation. Read more
Source§

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

Source§

type Output = <u2 as BitOr>::Output

The resulting type after applying the ^ operator.
Source§

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

Performs the ^ operation. Read more
Source§

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

Source§

type Output = <u2 as BitOr>::Output

The resulting type after applying the ^ operator.
Source§

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

Performs the ^ operation. Read more
Source§

impl<'a> BitXor for &'a u2

Source§

type Output = <u2 as BitOr>::Output

The resulting type after applying the ^ operator.
Source§

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

Performs the ^ operation. Read more
Source§

impl BitXor for u2

Source§

type Output = u2

The resulting type after applying the ^ operator.
Source§

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

Performs the ^ operation. Read more
Source§

impl BitXorAssign for u2

Source§

fn bitxor_assign(&mut self, other: u2)

Performs the ^= operation. Read more
Source§

impl Clone for u2

Source§

fn clone(&self) -> u2

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 u2

Source§

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

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

impl Default for u2

Source§

fn default() -> u2

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

impl Deref for u2

Source§

type Target = i8

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl DerefMut for u2

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl Display for u2

Source§

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

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

impl Div for u2

Source§

type Output = u2

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl From<i8> for u2

Source§

fn from(source: i8) -> u2

Converts to this type from the input type.
Source§

impl Hash for u2

Source§

fn hash<H: Hasher>(&self, h: &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 Into<i8> for u2

Source§

fn into(self) -> i8

Converts this type into the (usually inferred) input type.
Source§

impl LowerHex for u2

Source§

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

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

impl Mul for u2

Source§

type Output = u2

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl<'a> Not for &'a u2

Source§

type Output = <u2 as Not>::Output

The resulting type after applying the ! operator.
Source§

fn not(self) -> u2

Performs the unary ! operation. Read more
Source§

impl Not for u2

Source§

type Output = u2

The resulting type after applying the ! operator.
Source§

fn not(self) -> u2

Performs the unary ! operation. Read more
Source§

impl Octal for u2

Source§

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

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

impl Ord for u2

Source§

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

Source§

fn eq(&self, other: &Self) -> 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 u2

Source§

fn partial_cmp(&self, other: &u2) -> 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> Shl<T> for u2
where i8: Shl<T, Output = i8>,

Source§

type Output = u2

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

fn shl(self, rhs: T) -> u2

Performs the << operation. Read more
Source§

impl<T> ShlAssign<T> for u2
where i8: ShlAssign<T>,

Source§

fn shl_assign(&mut self, rhs: T)

Performs the <<= operation. Read more
Source§

impl<T> Shr<T> for u2
where i8: Shr<T, Output = i8>,

Source§

type Output = u2

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

fn shr(self, rhs: T) -> u2

Performs the >> operation. Read more
Source§

impl<T> ShrAssign<T> for u2
where i8: ShrAssign<T>,

Source§

fn shr_assign(&mut self, rhs: T)

Performs the >>= operation. Read more
Source§

impl Sub for u2

Source§

type Output = u2

The resulting type after applying the - operator.
Source§

fn sub(self, other: u2) -> u2

Performs the - operation. Read more
Source§

impl UpperHex for u2

Source§

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

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

impl Copy for u2

Source§

impl Eq for u2

Auto Trait Implementations§

§

impl Freeze for u2

§

impl RefUnwindSafe for u2

§

impl Send for u2

§

impl Sync for u2

§

impl Unpin for u2

§

impl UnwindSafe for u2

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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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.