Struct i20

Source
pub struct i20(/* private fields */);
Expand description

An unsigned integer which contains 20 bits

Implementations§

Source§

impl i20

Source

pub const MAX: i32 = 524_287i32

The largest value this type can hold

Source

pub const MIN: i32 = -524_288i32

The smallest value this type can hold

Source

pub const unsafe fn new_unchecked(value: i32) -> 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: i32) -> Option<Self>

Create a new $name from value

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

pub const fn value(self) -> i32

Get the value stored in here, as a signed integer

Trait Implementations§

Source§

impl Add for i20

Source§

type Output = i20

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl BitAnd for i20

Source§

type Output = i20

The resulting type after applying the & operator.
Source§

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

Performs the & operation. Read more
Source§

impl BitAndAssign for i20

Source§

fn bitand_assign(&mut self, rhs: Self)

Performs the &= operation. Read more
Source§

impl BitCount for i20

Source§

const COUNT: usize = 20usize

The number of bits associated with this type
Source§

impl BitOr for i20

Source§

type Output = i20

The resulting type after applying the | operator.
Source§

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

Performs the | operation. Read more
Source§

impl BitOrAssign for i20

Source§

fn bitor_assign(&mut self, rhs: Self)

Performs the |= operation. Read more
Source§

impl BitXor for i20

Source§

type Output = i20

The resulting type after applying the ^ operator.
Source§

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

Performs the ^ operation. Read more
Source§

impl BitXorAssign for i20

Source§

fn bitxor_assign(&mut self, rhs: Self)

Performs the ^= operation. Read more
Source§

impl BitsFitIn<u21> for i20

Source§

fn fit(self) -> u21

Fits self into the target type
Source§

impl BitsFitIn<u22> for i20

Source§

fn fit(self) -> u22

Fits self into the target type
Source§

impl BitsFitIn<u23> for i20

Source§

fn fit(self) -> u23

Fits self into the target type
Source§

impl BitsFitIn<u24> for i20

Source§

fn fit(self) -> u24

Fits self into the target type
Source§

impl BitsFitIn<u25> for i20

Source§

fn fit(self) -> u25

Fits self into the target type
Source§

impl BitsFitIn<u26> for i20

Source§

fn fit(self) -> u26

Fits self into the target type
Source§

impl BitsFitIn<u27> for i20

Source§

fn fit(self) -> u27

Fits self into the target type
Source§

impl BitsFitIn<u28> for i20

Source§

fn fit(self) -> u28

Fits self into the target type
Source§

impl BitsFitIn<u29> for i20

Source§

fn fit(self) -> u29

Fits self into the target type
Source§

impl BitsFitIn<u30> for i20

Source§

fn fit(self) -> u30

Fits self into the target type
Source§

impl BitsFitIn<u31> for i20

Source§

fn fit(self) -> u31

Fits self into the target type
Source§

impl BitsFitIn<u32> for i20

Source§

fn fit(self) -> u32

Fits self into the target type
Source§

impl BitsFitIn<u33> for i20

Source§

fn fit(self) -> u33

Fits self into the target type
Source§

impl BitsFitIn<u34> for i20

Source§

fn fit(self) -> u34

Fits self into the target type
Source§

impl BitsFitIn<u35> for i20

Source§

fn fit(self) -> u35

Fits self into the target type
Source§

impl BitsFitIn<u36> for i20

Source§

fn fit(self) -> u36

Fits self into the target type
Source§

impl BitsFitIn<u37> for i20

Source§

fn fit(self) -> u37

Fits self into the target type
Source§

impl BitsFitIn<u38> for i20

Source§

fn fit(self) -> u38

Fits self into the target type
Source§

impl BitsFitIn<u39> for i20

Source§

fn fit(self) -> u39

Fits self into the target type
Source§

impl BitsFitIn<u40> for i20

Source§

fn fit(self) -> u40

Fits self into the target type
Source§

impl BitsFitIn<u41> for i20

Source§

fn fit(self) -> u41

Fits self into the target type
Source§

impl BitsFitIn<u42> for i20

Source§

fn fit(self) -> u42

Fits self into the target type
Source§

impl BitsFitIn<u43> for i20

Source§

fn fit(self) -> u43

Fits self into the target type
Source§

impl BitsFitIn<u44> for i20

Source§

fn fit(self) -> u44

Fits self into the target type
Source§

impl BitsFitIn<u45> for i20

Source§

fn fit(self) -> u45

Fits self into the target type
Source§

impl BitsFitIn<u46> for i20

Source§

fn fit(self) -> u46

Fits self into the target type
Source§

impl BitsFitIn<u47> for i20

Source§

fn fit(self) -> u47

Fits self into the target type
Source§

impl BitsFitIn<u48> for i20

Source§

fn fit(self) -> u48

Fits self into the target type
Source§

impl BitsFitIn<u49> for i20

Source§

fn fit(self) -> u49

Fits self into the target type
Source§

impl BitsFitIn<u50> for i20

Source§

fn fit(self) -> u50

Fits self into the target type
Source§

impl BitsFitIn<u51> for i20

Source§

fn fit(self) -> u51

Fits self into the target type
Source§

impl BitsFitIn<u52> for i20

Source§

fn fit(self) -> u52

Fits self into the target type
Source§

impl BitsFitIn<u53> for i20

Source§

fn fit(self) -> u53

Fits self into the target type
Source§

impl BitsFitIn<u54> for i20

Source§

fn fit(self) -> u54

Fits self into the target type
Source§

impl BitsFitIn<u55> for i20

Source§

fn fit(self) -> u55

Fits self into the target type
Source§

impl BitsFitIn<u56> for i20

Source§

fn fit(self) -> u56

Fits self into the target type
Source§

impl BitsFitIn<u57> for i20

Source§

fn fit(self) -> u57

Fits self into the target type
Source§

impl BitsFitIn<u58> for i20

Source§

fn fit(self) -> u58

Fits self into the target type
Source§

impl BitsFitIn<u59> for i20

Source§

fn fit(self) -> u59

Fits self into the target type
Source§

impl BitsFitIn<u60> for i20

Source§

fn fit(self) -> u60

Fits self into the target type
Source§

impl BitsFitIn<u61> for i20

Source§

fn fit(self) -> u61

Fits self into the target type
Source§

impl BitsFitIn<u62> for i20

Source§

fn fit(self) -> u62

Fits self into the target type
Source§

impl BitsFitIn<u63> for i20

Source§

fn fit(self) -> u63

Fits self into the target type
Source§

impl BitsFitIn<u64> for i20

Source§

fn fit(self) -> u64

Fits self into the target type
Source§

impl Bounded for i20

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 i20

Source§

fn clone(&self) -> i20

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 i20

Source§

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

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

impl Default for i20

Source§

fn default() -> Self

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

impl<'de> Deserialize<'de> for i20

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 i20

Source§

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

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

impl Div for i20

Source§

type Output = i20

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl FieldStorage for i20

Source§

type StoredType = u32

The type this field stores as
Source§

fn inner_raw(self) -> Self::StoredType

Get the raw representation of this value
Source§

impl FromStr for i20

Source§

type Err = <i20 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 i20

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 for i20

Source§

type Output = i20

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Num for i20

Source§

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 i20

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) -> bool
where Self: PartialEq,

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

impl Ord for i20

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) -> 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 i20

Source§

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

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

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 Rem for i20

Source§

type Output = i20

The resulting type after applying the % operator.
Source§

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

Performs the % operation. Read more
Source§

impl Serialize for i20

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 i20

Source§

type Output = i20

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 i20

Source§

fn shl_assign(&mut self, rhs: usize)

Performs the <<= operation. Read more
Source§

impl Shr<usize> for i20

Source§

type Output = i20

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 i20

Source§

fn shr_assign(&mut self, rhs: usize)

Performs the >>= operation. Read more
Source§

impl Sub for i20

Source§

type Output = i20

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 i20

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 i20

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 i20

Source§

impl Eq for i20

Source§

impl StructuralPartialEq for i20

Auto Trait Implementations§

§

impl Freeze for i20

§

impl RefUnwindSafe for i20

§

impl Send for i20

§

impl Sync for i20

§

impl Unpin for i20

§

impl UnwindSafe for i20

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> BitStructZero for T
where T: Zero,

Source§

fn bs_zero() -> Self

Get a zero value for this bit struct
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<T> LowerBounded for T
where T: Bounded,

Source§

fn min_value() -> T

Returns the smallest finite number this type can represent
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.
Source§

impl<T> UpperBounded for T
where T: Bounded,

Source§

fn max_value() -> T

Returns the largest finite number this type can represent
Source§

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

Source§

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