Struct array_map::IndexU16[][src]

#[repr(transparent)]
#[must_use]
pub struct IndexU16<const N: u16>(_);
Expand description

This struct implements Indexable and allows all values in 0..N

Implementations

impl<const N: u16> IndexU16<N>[src]

#[must_use]
pub fn new(u: u16) -> Option<Self>
[src]

Returns a new IndexU8 if it is in a valid range

#[must_use]
pub fn get(self) -> u16
[src]

Returns the underlying u8

Trait Implementations

impl<const N: u16> Clone for IndexU16<N>[src]

fn clone(&self) -> IndexU16<N>[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<const N: u16> Debug for IndexU16<N>[src]

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

Formats the value using the given formatter. Read more

impl<const N: u16> Default for IndexU16<N>[src]

fn default() -> IndexU16<N>[src]

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

impl<'de, const N: u16> Deserialize<'de> for IndexU16<N>[src]

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
    __D: Deserializer<'de>, 
[src]

Deserialize this value from the given Serde deserializer. Read more

impl<const N: u16> Indexable for IndexU16<N>[src]

const SIZE: usize[src]

The number of items or variants that this type can have.

type Iter = Map<Range<u16>, fn(_: u16) -> Self>

The type of Iterator that will be returned by Self::iter()

fn index(self) -> usize[src]

Maps self to usize to know which value in the underling array to use Read more

fn iter() -> Self::Iter[src]

An Iterator over all valid values of self Read more

impl<const N: u16> Ord for IndexU16<N>[src]

fn cmp(&self, other: &IndexU16<N>) -> 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<const N: u16> PartialEq<IndexU16<N>> for IndexU16<N>[src]

fn eq(&self, other: &IndexU16<N>) -> bool[src]

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

fn ne(&self, other: &IndexU16<N>) -> bool[src]

This method tests for !=.

impl<const N: u16> PartialOrd<IndexU16<N>> for IndexU16<N>[src]

fn partial_cmp(&self, other: &IndexU16<N>) -> 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<const N: u16> ReverseIndexable for IndexU16<N>[src]

fn from_index(u: usize) -> Self[src]

Converts from a usize to Self

impl<const N: u16> Serialize for IndexU16<N>[src]

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
    __S: Serializer
[src]

Serialize this value into the given Serde serializer. Read more

impl<const N: u16> Copy for IndexU16<N>[src]

impl<const N: u16> Eq for IndexU16<N>[src]

impl<const N: u16> StructuralEq for IndexU16<N>[src]

impl<const N: u16> StructuralPartialEq for IndexU16<N>[src]

Auto Trait Implementations

impl<const N: u16> Send for IndexU16<N>

impl<const N: u16> Sync for IndexU16<N>

impl<const N: u16> Unpin for IndexU16<N>

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.

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