Skip to main content

AsUSize

Trait AsUSize 

Source
pub trait AsUSize {
    // Required method
    fn as_usize(&self) -> usize;
}
Expand description

Trait defining instance method as_usize() : usize that provides a cost-free conversion into usize.

It is expected that the implementing type “is-a” usize in a direct manner as well as in a logical manner.

§Additional Implementations on Foreign Types

§Built-in Types

If the feature "implement-AsUSize-for-built_ins" is defined (as it is by "default"), then this is also implemented for the following type(s):

Required Methods§

Source

fn as_usize(&self) -> usize

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl AsUSize for usize

Source§

fn as_usize(&self) -> usize

Source§

impl<T: AsUSize + ?Sized> AsUSize for Box<T>

Available on non-crate feature nostd only.
Source§

fn as_usize(&self) -> usize

Source§

impl<T: AsUSize + ?Sized> AsUSize for Rc<T>

Available on non-crate feature nostd only.
Source§

fn as_usize(&self) -> usize

Implementors§