CastUsize

Trait CastUsize 

Source
pub trait CastUsize {
    // Required methods
    fn cast_to(self) -> usize;
    fn cast_from(val: usize) -> Self;
}
Expand description

Trait for casting between an unsigned integer to a usize, and vice versa. Note: to() would panic if the value is greater or equal to the type’s max.

Required Methods§

Source

fn cast_to(self) -> usize

Turning an unsigned integer into a usize.

Source

fn cast_from(val: usize) -> Self

Turning a usize into an unsigned integer.

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 CastUsize for u8

Source§

impl CastUsize for u16

Source§

impl CastUsize for u32

Source§

impl CastUsize for usize

Implementors§