pub trait WrappingCast<T>: Sized {
// Required method
fn wrapping_cast(self) -> T;
}Expand description
Wrapping conversion between any two integer types
(std’s generic wrapping_cast — the semantics of as).
Required Methods§
Sourcefn wrapping_cast(self) -> T
fn wrapping_cast(self) -> T
Converts self to the target type, wrapping around at the boundary
of the type.
use const_num_traits::WrappingCast;
let x: u8 = WrappingCast::wrapping_cast(300u16);
assert_eq!(x, 44);Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".