Struct bit_struct::i2

source ·
pub struct i2(_);
Expand description

An unsigned integer which contains 2 bits

Implementations§

source§

impl i2

source

pub const unsafe fn new_unchecked(value: i8) -> Self

Create a new $name from value

Safety
  • value must fit within the number of bits defined in the type
source

pub fn new(value: i8) -> Option<Self>

Create a new $name from value

Safety
  • value must fit within the number of bits defined in the type
source

pub const MAX: i8 = 1i8

The largest value this type can hold

source

pub const MIN: i8 = -2i8

The smallest value this type can hold

source

pub const fn value(self) -> i8

Get the value stored in here, as a signed integer

Trait Implementations§

source§

impl Add<i2> for i2

§

type Output = i2

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl BitAnd<i2> for i2

§

type Output = i2

The resulting type after applying the & operator.
source§

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

Performs the & operation. Read more
source§

impl BitAndAssign<i2> for i2

source§

fn bitand_assign(&mut self, rhs: Self)

Performs the &= operation. Read more
source§

impl BitCount for i2

source§

const COUNT: usize = 2usize

The number of bits associated with this type
source§

impl BitOr<i2> for i2

§

type Output = i2

The resulting type after applying the | operator.
source§

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

Performs the | operation. Read more
source§

impl BitOrAssign<i2> for i2

source§

fn bitor_assign(&mut self, rhs: Self)

Performs the |= operation. Read more
source§

impl BitXor<i2> for i2

§

type Output = i2

The resulting type after applying the ^ operator.
source§

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

Performs the ^ operation. Read more
source§

impl BitXorAssign<i2> for i2

source§

fn bitxor_assign(&mut self, rhs: Self)

Performs the ^= operation. Read more
source§

impl BitsFitIn<u10> for i2

source§

fn fit(self) -> u10

Fits self into the target type
source§

impl BitsFitIn<u11> for i2

source§

fn fit(self) -> u11

Fits self into the target type
source§

impl BitsFitIn<u12> for i2

source§

fn fit(self) -> u12

Fits self into the target type
source§

impl BitsFitIn<u13> for i2

source§

fn fit(self) -> u13

Fits self into the target type
source§

impl BitsFitIn<u14> for i2

source§

fn fit(self) -> u14

Fits self into the target type
source§

impl BitsFitIn<u15> for i2

source§

fn fit(self) -> u15

Fits self into the target type
source§

impl BitsFitIn<u16> for i2

source§

fn fit(self) -> u16

Fits self into the target type
source§

impl BitsFitIn<u17> for i2

source§

fn fit(self) -> u17

Fits self into the target type
source§

impl BitsFitIn<u18> for i2

source§

fn fit(self) -> u18

Fits self into the target type
source§

impl BitsFitIn<u19> for i2

source§

fn fit(self) -> u19

Fits self into the target type
source§

impl BitsFitIn<u20> for i2

source§

fn fit(self) -> u20

Fits self into the target type
source§

impl BitsFitIn<u21> for i2

source§

fn fit(self) -> u21

Fits self into the target type
source§

impl BitsFitIn<u22> for i2

source§

fn fit(self) -> u22

Fits self into the target type
source§

impl BitsFitIn<u23> for i2

source§

fn fit(self) -> u23

Fits self into the target type
source§

impl BitsFitIn<u24> for i2

source§

fn fit(self) -> u24

Fits self into the target type
source§

impl BitsFitIn<u25> for i2

source§

fn fit(self) -> u25

Fits self into the target type
source§

impl BitsFitIn<u26> for i2

source§

fn fit(self) -> u26

Fits self into the target type
source§

impl BitsFitIn<u27> for i2

source§

fn fit(self) -> u27

Fits self into the target type
source§

impl BitsFitIn<u28> for i2

source§

fn fit(self) -> u28

Fits self into the target type
source§

impl BitsFitIn<u29> for i2

source§

fn fit(self) -> u29

Fits self into the target type
source§

impl BitsFitIn<u3> for i2

source§

fn fit(self) -> u3

Fits self into the target type
source§

impl BitsFitIn<u30> for i2

source§

fn fit(self) -> u30

Fits self into the target type
source§

impl BitsFitIn<u31> for i2

source§

fn fit(self) -> u31

Fits self into the target type
source§

impl BitsFitIn<u32> for i2

source§

fn fit(self) -> u32

Fits self into the target type
source§

impl BitsFitIn<u33> for i2

source§

fn fit(self) -> u33

Fits self into the target type
source§

impl BitsFitIn<u34> for i2

source§

fn fit(self) -> u34

Fits self into the target type
source§

impl BitsFitIn<u35> for i2

source§

fn fit(self) -> u35

Fits self into the target type
source§

impl BitsFitIn<u36> for i2

source§

fn fit(self) -> u36

Fits self into the target type
source§

impl BitsFitIn<u37> for i2

source§

fn fit(self) -> u37

Fits self into the target type
source§

impl BitsFitIn<u38> for i2

source§

fn fit(self) -> u38

Fits self into the target type
source§

impl BitsFitIn<u39> for i2

source§

fn fit(self) -> u39

Fits self into the target type
source§

impl BitsFitIn<u4> for i2

source§

fn fit(self) -> u4

Fits self into the target type
source§

impl BitsFitIn<u40> for i2

source§

fn fit(self) -> u40

Fits self into the target type
source§

impl BitsFitIn<u41> for i2

source§

fn fit(self) -> u41

Fits self into the target type
source§

impl BitsFitIn<u42> for i2

source§

fn fit(self) -> u42

Fits self into the target type
source§

impl BitsFitIn<u43> for i2

source§

fn fit(self) -> u43

Fits self into the target type
source§

impl BitsFitIn<u44> for i2

source§

fn fit(self) -> u44

Fits self into the target type
source§

impl BitsFitIn<u45> for i2

source§

fn fit(self) -> u45

Fits self into the target type
source§

impl BitsFitIn<u46> for i2

source§

fn fit(self) -> u46

Fits self into the target type
source§

impl BitsFitIn<u47> for i2

source§

fn fit(self) -> u47

Fits self into the target type
source§

impl BitsFitIn<u48> for i2

source§

fn fit(self) -> u48

Fits self into the target type
source§

impl BitsFitIn<u49> for i2

source§

fn fit(self) -> u49

Fits self into the target type
source§

impl BitsFitIn<u5> for i2

source§

fn fit(self) -> u5

Fits self into the target type
source§

impl BitsFitIn<u50> for i2

source§

fn fit(self) -> u50

Fits self into the target type
source§

impl BitsFitIn<u51> for i2

source§

fn fit(self) -> u51

Fits self into the target type
source§

impl BitsFitIn<u52> for i2

source§

fn fit(self) -> u52

Fits self into the target type
source§

impl BitsFitIn<u53> for i2

source§

fn fit(self) -> u53

Fits self into the target type
source§

impl BitsFitIn<u54> for i2

source§

fn fit(self) -> u54

Fits self into the target type
source§

impl BitsFitIn<u55> for i2

source§

fn fit(self) -> u55

Fits self into the target type
source§

impl BitsFitIn<u56> for i2

source§

fn fit(self) -> u56

Fits self into the target type
source§

impl BitsFitIn<u57> for i2

source§

fn fit(self) -> u57

Fits self into the target type
source§

impl BitsFitIn<u58> for i2

source§

fn fit(self) -> u58

Fits self into the target type
source§

impl BitsFitIn<u59> for i2

source§

fn fit(self) -> u59

Fits self into the target type
source§

impl BitsFitIn<u6> for i2

source§

fn fit(self) -> u6

Fits self into the target type
source§

impl BitsFitIn<u60> for i2

source§

fn fit(self) -> u60

Fits self into the target type
source§

impl BitsFitIn<u61> for i2

source§

fn fit(self) -> u61

Fits self into the target type
source§

impl BitsFitIn<u62> for i2

source§

fn fit(self) -> u62

Fits self into the target type
source§

impl BitsFitIn<u63> for i2

source§

fn fit(self) -> u63

Fits self into the target type
source§

impl BitsFitIn<u64> for i2

source§

fn fit(self) -> u64

Fits self into the target type
source§

impl BitsFitIn<u7> for i2

source§

fn fit(self) -> u7

Fits self into the target type
source§

impl BitsFitIn<u8> for i2

source§

fn fit(self) -> u8

Fits self into the target type
source§

impl BitsFitIn<u9> for i2

source§

fn fit(self) -> u9

Fits self into the target type
source§

impl Bounded for i2

source§

fn min_value() -> Self

Returns the smallest finite number this type can represent
source§

fn max_value() -> Self

Returns the largest finite number this type can represent
source§

impl Clone for i2

source§

fn clone(&self) -> i2

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 i2

source§

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

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

impl Default for i2

source§

fn default() -> Self

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

impl<'de> Deserialize<'de> for i2

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 Display for i2

source§

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

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

impl Div<i2> for i2

§

type Output = i2

The resulting type after applying the / operator.
source§

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

Performs the / operation. Read more
source§

impl FieldStorage for i2

§

type StoredType = u8

The type this field stores as
source§

fn inner_raw(self) -> Self::StoredType

Get the raw representation of this value
source§

impl FromStr for i2

§

type Err = <i2 as Num>::FromStrRadixErr

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 i2

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 Mul<i2> for i2

§

type Output = i2

The resulting type after applying the * operator.
source§

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

Performs the * operation. Read more
source§

impl Num for i2

§

type FromStrRadixErr = ()

source§

fn from_str_radix(str: &str, radix: u32) -> Result<Self, Self::FromStrRadixErr>

Convert from a string and radix (typically 2..=36). Read more
source§

impl One for i2

source§

fn one() -> Self

Returns the multiplicative identity element of Self, 1. Read more
source§

fn set_one(&mut self)

Sets self to the multiplicative identity element of Self, 1.
source§

fn is_one(&self) -> boolwhere
Self: PartialEq<Self>,

Returns true if self is equal to the multiplicative identity. Read more
source§

impl Ord for i2

source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Selfwhere
Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Selfwhere
Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,

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

impl PartialEq<i2> for i2

source§

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

source§

fn partial_cmp(&self, other: &Self) -> 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 Rem<i2> for i2

§

type Output = i2

The resulting type after applying the % operator.
source§

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

Performs the % operation. Read more
source§

impl Serialize for i2

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<usize> for i2

§

type Output = i2

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

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

Performs the << operation. Read more
source§

impl ShlAssign<usize> for i2

source§

fn shl_assign(&mut self, rhs: usize)

Performs the <<= operation. Read more
source§

impl Shr<usize> for i2

§

type Output = i2

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

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

Performs the >> operation. Read more
source§

impl ShrAssign<usize> for i2

source§

fn shr_assign(&mut self, rhs: usize)

Performs the >>= operation. Read more
source§

impl Sub<i2> for i2

§

type Output = i2

The resulting type after applying the - operator.
source§

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

Performs the - operation. Read more
source§

impl<P> ValidCheck<P> for i2

source§

const ALWAYS_VALID: bool = true

Set this to true if, at compile-time, we can tell that all bit representations which contain the appropriate number of bits are valid representations of this type
source§

fn is_valid(_input: P) -> bool

Return whether or not the underlying bits of P are valid representation of this type
source§

impl Zero for i2

source§

fn zero() -> Self

Returns the additive identity element of Self, 0. Read more
source§

fn is_zero(&self) -> bool

Returns true if self is equal to the additive identity.
source§

fn set_zero(&mut self)

Sets self to the additive identity element of Self, 0.
source§

impl Copy for i2

source§

impl Eq for i2

source§

impl StructuralEq for i2

source§

impl StructuralPartialEq for i2

Auto Trait Implementations§

§

impl RefUnwindSafe for i2

§

impl Send for i2

§

impl Sync for i2

§

impl Unpin for i2

§

impl UnwindSafe for i2

Blanket Implementations§

source§

impl<T> Any for Twhere
T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> BitStructZero for Twhere
T: Zero,

source§

fn bs_zero() -> Self

Get a zero value for this bit struct
source§

impl<T> Borrow<T> for Twhere
T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere
T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere
U: From<T>,

const: unstable · 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> LowerBounded for Twhere
T: Bounded,

source§

fn min_value() -> T

Returns the smallest finite number this type can represent
source§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

impl<T> UpperBounded for Twhere
T: Bounded,

source§

fn max_value() -> T

Returns the largest finite number this type can represent
source§

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

source§

impl<T, Rhs, Output> NumOps<Rhs, Output> for Twhere
T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>,