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§
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.