Trait CopyAs

Source
pub trait CopyAs<T>: Copy {
    // Required method
    fn copy_as(self) -> T;
}
Expand description

Types that can be converted into another type by copying.

We use this trait to unify the ability of T and &T to be converted into T. This is handy for copy types that we’d like to use, like u8, u64 and usize.

Required Methods§

Source

fn copy_as(self) -> T

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<T: Copy> CopyAs<T> for &T

Source§

fn copy_as(self) -> T

Implementors§

Source§

impl<T: Copy> CopyAs<T> for T