pub trait WrappingCast<Dst> {
    fn wrapping_cast(self) -> Dst;
}
Expand description

Wrapping cast.

It is normally easier to use the WrappingAs trait instead of this trait.

Panics

This trait’s method panics if the value does not fit and cannot be wrapped, for example when trying to cast floating-point ∞ into an integer type.

Examples

use az::WrappingCast;
let a: u32 = (-1).wrapping_cast();
assert_eq!(a, u32::max_value());
assert_eq!(WrappingCast::<u8>::wrapping_cast(17.0 + 256.0), 17);

Required methods

Casts the value.

Implementations on Foreign Types

Implementors