Trait Idx

Source
pub unsafe trait Idx:
    Copy
    + Ord
    + Hash
where Self: Debug,
{ // Required methods fn as_usize(self) -> usize; fn from_usize(i: usize) -> Option<Self>; fn zero() -> Self; fn add(self, increment: usize) -> Self; fn sub(self, decrement: usize) -> Self; }
Expand description

Unsigned integers able to be used as a trusted index.

Required Methods§

Source

fn as_usize(self) -> usize

Source

fn from_usize(i: usize) -> Option<Self>

Source

fn zero() -> Self

Source

fn add(self, increment: usize) -> Self

Source

fn sub(self, decrement: usize) -> Self

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Idx for u8

Source§

fn as_usize(self) -> usize

Source§

fn from_usize(i: usize) -> Option<Self>

Source§

fn zero() -> Self

Source§

fn add(self, increment: usize) -> Self

Source§

fn sub(self, decrement: usize) -> Self

Source§

impl Idx for u16

Source§

fn as_usize(self) -> usize

Source§

fn from_usize(i: usize) -> Option<Self>

Source§

fn zero() -> Self

Source§

fn add(self, increment: usize) -> Self

Source§

fn sub(self, decrement: usize) -> Self

Source§

impl Idx for u32

Source§

fn as_usize(self) -> usize

Source§

fn from_usize(i: usize) -> Option<Self>

Source§

fn zero() -> Self

Source§

fn add(self, increment: usize) -> Self

Source§

fn sub(self, decrement: usize) -> Self

Source§

impl Idx for usize

Source§

fn as_usize(self) -> usize

Source§

fn from_usize(i: usize) -> Option<Self>

Source§

fn zero() -> Self

Source§

fn add(self, increment: usize) -> Self

Source§

fn sub(self, decrement: usize) -> Self

Implementors§