StrictCast

Trait StrictCast 

Source
pub trait StrictCast<Dst> {
    // Required method
    fn strict_cast(self) -> Dst;
}
Expand description

Used to cast values, panicking if the value does not fit.

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

§Panics

This trait’s method panics if the value does not fit in the destination, even when debug assertions are not enabled.

§Examples

use az::StrictCast;
let a: u32 = 5i32.strict_cast();
assert_eq!(a, 5);
assert_eq!(StrictCast::<u8>::strict_cast(17.1f32), 17);

The following panics because of overflow.

use az::StrictCast;
let _overflow: u32 = (-5i32).strict_cast();

Required Methods§

Source

fn strict_cast(self) -> Dst

Casts the value.

Implementations on Foreign Types§

Source§

impl StrictCast<f32> for f32

Source§

impl StrictCast<f32> for f64

Source§

impl StrictCast<f32> for i8

Source§

impl StrictCast<f32> for i16

Source§

impl StrictCast<f32> for i32

Source§

impl StrictCast<f32> for i64

Source§

impl StrictCast<f32> for i128

Source§

impl StrictCast<f32> for isize

Source§

impl StrictCast<f32> for u8

Source§

impl StrictCast<f32> for u16

Source§

impl StrictCast<f32> for u32

Source§

impl StrictCast<f32> for u64

Source§

impl StrictCast<f32> for u128

Source§

impl StrictCast<f32> for usize

Source§

impl StrictCast<f64> for f32

Source§

impl StrictCast<f64> for f64

Source§

impl StrictCast<f64> for i8

Source§

impl StrictCast<f64> for i16

Source§

impl StrictCast<f64> for i32

Source§

impl StrictCast<f64> for i64

Source§

impl StrictCast<f64> for i128

Source§

impl StrictCast<f64> for isize

Source§

impl StrictCast<f64> for u8

Source§

impl StrictCast<f64> for u16

Source§

impl StrictCast<f64> for u32

Source§

impl StrictCast<f64> for u64

Source§

impl StrictCast<f64> for u128

Source§

impl StrictCast<f64> for usize

Source§

impl StrictCast<i8> for bool

Source§

impl StrictCast<i8> for f32

Source§

impl StrictCast<i8> for f64

Source§

impl StrictCast<i8> for i8

Source§

impl StrictCast<i8> for i16

Source§

impl StrictCast<i8> for i32

Source§

impl StrictCast<i8> for i64

Source§

impl StrictCast<i8> for i128

Source§

impl StrictCast<i8> for isize

Source§

impl StrictCast<i8> for u8

Source§

impl StrictCast<i8> for u16

Source§

impl StrictCast<i8> for u32

Source§

impl StrictCast<i8> for u64

Source§

impl StrictCast<i8> for u128

Source§

impl StrictCast<i8> for usize

Source§

impl StrictCast<i16> for bool

Source§

impl StrictCast<i16> for f32

Source§

impl StrictCast<i16> for f64

Source§

impl StrictCast<i16> for i8

Source§

impl StrictCast<i16> for i16

Source§

impl StrictCast<i16> for i32

Source§

impl StrictCast<i16> for i64

Source§

impl StrictCast<i16> for i128

Source§

impl StrictCast<i16> for isize

Source§

impl StrictCast<i16> for u8

Source§

impl StrictCast<i16> for u16

Source§

impl StrictCast<i16> for u32

Source§

impl StrictCast<i16> for u64

Source§

impl StrictCast<i16> for u128

Source§

impl StrictCast<i16> for usize

Source§

impl StrictCast<i32> for bool

Source§

impl StrictCast<i32> for f32

Source§

impl StrictCast<i32> for f64

Source§

impl StrictCast<i32> for i8

Source§

impl StrictCast<i32> for i16

Source§

impl StrictCast<i32> for i32

Source§

impl StrictCast<i32> for i64

Source§

impl StrictCast<i32> for i128

Source§

impl StrictCast<i32> for isize

Source§

impl StrictCast<i32> for u8

Source§

impl StrictCast<i32> for u16

Source§

impl StrictCast<i32> for u32

Source§

impl StrictCast<i32> for u64

Source§

impl StrictCast<i32> for u128

Source§

impl StrictCast<i32> for usize

Source§

impl StrictCast<i64> for bool

Source§

impl StrictCast<i64> for f32

Source§

impl StrictCast<i64> for f64

Source§

impl StrictCast<i64> for i8

Source§

impl StrictCast<i64> for i16

Source§

impl StrictCast<i64> for i32

Source§

impl StrictCast<i64> for i64

Source§

impl StrictCast<i64> for i128

Source§

impl StrictCast<i64> for isize

Source§

impl StrictCast<i64> for u8

Source§

impl StrictCast<i64> for u16

Source§

impl StrictCast<i64> for u32

Source§

impl StrictCast<i64> for u64

Source§

impl StrictCast<i64> for u128

Source§

impl StrictCast<i64> for usize

Source§

impl StrictCast<i128> for bool

Source§

impl StrictCast<i128> for f32

Source§

impl StrictCast<i128> for f64

Source§

impl StrictCast<i128> for i8

Source§

impl StrictCast<i128> for i16

Source§

impl StrictCast<i128> for i32

Source§

impl StrictCast<i128> for i64

Source§

impl StrictCast<i128> for i128

Source§

impl StrictCast<i128> for isize

Source§

impl StrictCast<i128> for u8

Source§

impl StrictCast<i128> for u16

Source§

impl StrictCast<i128> for u32

Source§

impl StrictCast<i128> for u64

Source§

impl StrictCast<i128> for u128

Source§

impl StrictCast<i128> for usize

Source§

impl StrictCast<isize> for bool

Source§

impl StrictCast<isize> for f32

Source§

impl StrictCast<isize> for f64

Source§

impl StrictCast<isize> for i8

Source§

impl StrictCast<isize> for i16

Source§

impl StrictCast<isize> for i32

Source§

impl StrictCast<isize> for i64

Source§

impl StrictCast<isize> for i128

Source§

impl StrictCast<isize> for isize

Source§

impl StrictCast<isize> for u8

Source§

impl StrictCast<isize> for u16

Source§

impl StrictCast<isize> for u32

Source§

impl StrictCast<isize> for u64

Source§

impl StrictCast<isize> for u128

Source§

impl StrictCast<isize> for usize

Source§

impl StrictCast<u8> for bool

Source§

impl StrictCast<u8> for f32

Source§

impl StrictCast<u8> for f64

Source§

impl StrictCast<u8> for i8

Source§

impl StrictCast<u8> for i16

Source§

impl StrictCast<u8> for i32

Source§

impl StrictCast<u8> for i64

Source§

impl StrictCast<u8> for i128

Source§

impl StrictCast<u8> for isize

Source§

impl StrictCast<u8> for u8

Source§

impl StrictCast<u8> for u16

Source§

impl StrictCast<u8> for u32

Source§

impl StrictCast<u8> for u64

Source§

impl StrictCast<u8> for u128

Source§

impl StrictCast<u8> for usize

Source§

impl StrictCast<u16> for bool

Source§

impl StrictCast<u16> for f32

Source§

impl StrictCast<u16> for f64

Source§

impl StrictCast<u16> for i8

Source§

impl StrictCast<u16> for i16

Source§

impl StrictCast<u16> for i32

Source§

impl StrictCast<u16> for i64

Source§

impl StrictCast<u16> for i128

Source§

impl StrictCast<u16> for isize

Source§

impl StrictCast<u16> for u8

Source§

impl StrictCast<u16> for u16

Source§

impl StrictCast<u16> for u32

Source§

impl StrictCast<u16> for u64

Source§

impl StrictCast<u16> for u128

Source§

impl StrictCast<u16> for usize

Source§

impl StrictCast<u32> for bool

Source§

impl StrictCast<u32> for f32

Source§

impl StrictCast<u32> for f64

Source§

impl StrictCast<u32> for i8

Source§

impl StrictCast<u32> for i16

Source§

impl StrictCast<u32> for i32

Source§

impl StrictCast<u32> for i64

Source§

impl StrictCast<u32> for i128

Source§

impl StrictCast<u32> for isize

Source§

impl StrictCast<u32> for u8

Source§

impl StrictCast<u32> for u16

Source§

impl StrictCast<u32> for u32

Source§

impl StrictCast<u32> for u64

Source§

impl StrictCast<u32> for u128

Source§

impl StrictCast<u32> for usize

Source§

impl StrictCast<u64> for bool

Source§

impl StrictCast<u64> for f32

Source§

impl StrictCast<u64> for f64

Source§

impl StrictCast<u64> for i8

Source§

impl StrictCast<u64> for i16

Source§

impl StrictCast<u64> for i32

Source§

impl StrictCast<u64> for i64

Source§

impl StrictCast<u64> for i128

Source§

impl StrictCast<u64> for isize

Source§

impl StrictCast<u64> for u8

Source§

impl StrictCast<u64> for u16

Source§

impl StrictCast<u64> for u32

Source§

impl StrictCast<u64> for u64

Source§

impl StrictCast<u64> for u128

Source§

impl StrictCast<u64> for usize

Source§

impl StrictCast<u128> for bool

Source§

impl StrictCast<u128> for f32

Source§

impl StrictCast<u128> for f64

Source§

impl StrictCast<u128> for i8

Source§

impl StrictCast<u128> for i16

Source§

impl StrictCast<u128> for i32

Source§

impl StrictCast<u128> for i64

Source§

impl StrictCast<u128> for i128

Source§

impl StrictCast<u128> for isize

Source§

impl StrictCast<u128> for u8

Source§

impl StrictCast<u128> for u16

Source§

impl StrictCast<u128> for u32

Source§

impl StrictCast<u128> for u64

Source§

impl StrictCast<u128> for u128

Source§

impl StrictCast<u128> for usize

Source§

impl StrictCast<usize> for bool

Source§

impl StrictCast<usize> for f32

Source§

impl StrictCast<usize> for f64

Source§

impl StrictCast<usize> for i8

Source§

impl StrictCast<usize> for i16

Source§

impl StrictCast<usize> for i32

Source§

impl StrictCast<usize> for i64

Source§

impl StrictCast<usize> for i128

Source§

impl StrictCast<usize> for isize

Source§

impl StrictCast<usize> for u8

Source§

impl StrictCast<usize> for u16

Source§

impl StrictCast<usize> for u32

Source§

impl StrictCast<usize> for u64

Source§

impl StrictCast<usize> for u128

Source§

impl StrictCast<usize> for usize

Source§

impl StrictCast<Wrapping<i8>> for bool

Source§

impl StrictCast<Wrapping<i8>> for f32

Source§

impl StrictCast<Wrapping<i8>> for f64

Source§

impl StrictCast<Wrapping<i8>> for i8

Source§

impl StrictCast<Wrapping<i8>> for i16

Source§

impl StrictCast<Wrapping<i8>> for i32

Source§

impl StrictCast<Wrapping<i8>> for i64

Source§

impl StrictCast<Wrapping<i8>> for i128

Source§

impl StrictCast<Wrapping<i8>> for isize

Source§

impl StrictCast<Wrapping<i8>> for u8

Source§

impl StrictCast<Wrapping<i8>> for u16

Source§

impl StrictCast<Wrapping<i8>> for u32

Source§

impl StrictCast<Wrapping<i8>> for u64

Source§

impl StrictCast<Wrapping<i8>> for u128

Source§

impl StrictCast<Wrapping<i8>> for usize

Source§

impl StrictCast<Wrapping<i16>> for bool

Source§

impl StrictCast<Wrapping<i16>> for f32

Source§

impl StrictCast<Wrapping<i16>> for f64

Source§

impl StrictCast<Wrapping<i16>> for i8

Source§

impl StrictCast<Wrapping<i16>> for i16

Source§

impl StrictCast<Wrapping<i16>> for i32

Source§

impl StrictCast<Wrapping<i16>> for i64

Source§

impl StrictCast<Wrapping<i16>> for i128

Source§

impl StrictCast<Wrapping<i16>> for isize

Source§

impl StrictCast<Wrapping<i16>> for u8

Source§

impl StrictCast<Wrapping<i16>> for u16

Source§

impl StrictCast<Wrapping<i16>> for u32

Source§

impl StrictCast<Wrapping<i16>> for u64

Source§

impl StrictCast<Wrapping<i16>> for u128

Source§

impl StrictCast<Wrapping<i16>> for usize

Source§

impl StrictCast<Wrapping<i32>> for bool

Source§

impl StrictCast<Wrapping<i32>> for f32

Source§

impl StrictCast<Wrapping<i32>> for f64

Source§

impl StrictCast<Wrapping<i32>> for i8

Source§

impl StrictCast<Wrapping<i32>> for i16

Source§

impl StrictCast<Wrapping<i32>> for i32

Source§

impl StrictCast<Wrapping<i32>> for i64

Source§

impl StrictCast<Wrapping<i32>> for i128

Source§

impl StrictCast<Wrapping<i32>> for isize

Source§

impl StrictCast<Wrapping<i32>> for u8

Source§

impl StrictCast<Wrapping<i32>> for u16

Source§

impl StrictCast<Wrapping<i32>> for u32

Source§

impl StrictCast<Wrapping<i32>> for u64

Source§

impl StrictCast<Wrapping<i32>> for u128

Source§

impl StrictCast<Wrapping<i32>> for usize

Source§

impl StrictCast<Wrapping<i64>> for bool

Source§

impl StrictCast<Wrapping<i64>> for f32

Source§

impl StrictCast<Wrapping<i64>> for f64

Source§

impl StrictCast<Wrapping<i64>> for i8

Source§

impl StrictCast<Wrapping<i64>> for i16

Source§

impl StrictCast<Wrapping<i64>> for i32

Source§

impl StrictCast<Wrapping<i64>> for i64

Source§

impl StrictCast<Wrapping<i64>> for i128

Source§

impl StrictCast<Wrapping<i64>> for isize

Source§

impl StrictCast<Wrapping<i64>> for u8

Source§

impl StrictCast<Wrapping<i64>> for u16

Source§

impl StrictCast<Wrapping<i64>> for u32

Source§

impl StrictCast<Wrapping<i64>> for u64

Source§

impl StrictCast<Wrapping<i64>> for u128

Source§

impl StrictCast<Wrapping<i64>> for usize

Source§

impl StrictCast<Wrapping<i128>> for bool

Source§

impl StrictCast<Wrapping<i128>> for f32

Source§

impl StrictCast<Wrapping<i128>> for f64

Source§

impl StrictCast<Wrapping<i128>> for i8

Source§

impl StrictCast<Wrapping<i128>> for i16

Source§

impl StrictCast<Wrapping<i128>> for i32

Source§

impl StrictCast<Wrapping<i128>> for i64

Source§

impl StrictCast<Wrapping<i128>> for i128

Source§

impl StrictCast<Wrapping<i128>> for isize

Source§

impl StrictCast<Wrapping<i128>> for u8

Source§

impl StrictCast<Wrapping<i128>> for u16

Source§

impl StrictCast<Wrapping<i128>> for u32

Source§

impl StrictCast<Wrapping<i128>> for u64

Source§

impl StrictCast<Wrapping<i128>> for u128

Source§

impl StrictCast<Wrapping<i128>> for usize

Source§

impl StrictCast<Wrapping<isize>> for bool

Source§

impl StrictCast<Wrapping<isize>> for f32

Source§

impl StrictCast<Wrapping<isize>> for f64

Source§

impl StrictCast<Wrapping<isize>> for i8

Source§

impl StrictCast<Wrapping<isize>> for i16

Source§

impl StrictCast<Wrapping<isize>> for i32

Source§

impl StrictCast<Wrapping<isize>> for i64

Source§

impl StrictCast<Wrapping<isize>> for i128

Source§

impl StrictCast<Wrapping<isize>> for isize

Source§

impl StrictCast<Wrapping<isize>> for u8

Source§

impl StrictCast<Wrapping<isize>> for u16

Source§

impl StrictCast<Wrapping<isize>> for u32

Source§

impl StrictCast<Wrapping<isize>> for u64

Source§

impl StrictCast<Wrapping<isize>> for u128

Source§

impl StrictCast<Wrapping<isize>> for usize

Source§

impl StrictCast<Wrapping<u8>> for bool

Source§

impl StrictCast<Wrapping<u8>> for f32

Source§

impl StrictCast<Wrapping<u8>> for f64

Source§

impl StrictCast<Wrapping<u8>> for i8

Source§

impl StrictCast<Wrapping<u8>> for i16

Source§

impl StrictCast<Wrapping<u8>> for i32

Source§

impl StrictCast<Wrapping<u8>> for i64

Source§

impl StrictCast<Wrapping<u8>> for i128

Source§

impl StrictCast<Wrapping<u8>> for isize

Source§

impl StrictCast<Wrapping<u8>> for u8

Source§

impl StrictCast<Wrapping<u8>> for u16

Source§

impl StrictCast<Wrapping<u8>> for u32

Source§

impl StrictCast<Wrapping<u8>> for u64

Source§

impl StrictCast<Wrapping<u8>> for u128

Source§

impl StrictCast<Wrapping<u8>> for usize

Source§

impl StrictCast<Wrapping<u16>> for bool

Source§

impl StrictCast<Wrapping<u16>> for f32

Source§

impl StrictCast<Wrapping<u16>> for f64

Source§

impl StrictCast<Wrapping<u16>> for i8

Source§

impl StrictCast<Wrapping<u16>> for i16

Source§

impl StrictCast<Wrapping<u16>> for i32

Source§

impl StrictCast<Wrapping<u16>> for i64

Source§

impl StrictCast<Wrapping<u16>> for i128

Source§

impl StrictCast<Wrapping<u16>> for isize

Source§

impl StrictCast<Wrapping<u16>> for u8

Source§

impl StrictCast<Wrapping<u16>> for u16

Source§

impl StrictCast<Wrapping<u16>> for u32

Source§

impl StrictCast<Wrapping<u16>> for u64

Source§

impl StrictCast<Wrapping<u16>> for u128

Source§

impl StrictCast<Wrapping<u16>> for usize

Source§

impl StrictCast<Wrapping<u32>> for bool

Source§

impl StrictCast<Wrapping<u32>> for f32

Source§

impl StrictCast<Wrapping<u32>> for f64

Source§

impl StrictCast<Wrapping<u32>> for i8

Source§

impl StrictCast<Wrapping<u32>> for i16

Source§

impl StrictCast<Wrapping<u32>> for i32

Source§

impl StrictCast<Wrapping<u32>> for i64

Source§

impl StrictCast<Wrapping<u32>> for i128

Source§

impl StrictCast<Wrapping<u32>> for isize

Source§

impl StrictCast<Wrapping<u32>> for u8

Source§

impl StrictCast<Wrapping<u32>> for u16

Source§

impl StrictCast<Wrapping<u32>> for u32

Source§

impl StrictCast<Wrapping<u32>> for u64

Source§

impl StrictCast<Wrapping<u32>> for u128

Source§

impl StrictCast<Wrapping<u32>> for usize

Source§

impl StrictCast<Wrapping<u64>> for bool

Source§

impl StrictCast<Wrapping<u64>> for f32

Source§

impl StrictCast<Wrapping<u64>> for f64

Source§

impl StrictCast<Wrapping<u64>> for i8

Source§

impl StrictCast<Wrapping<u64>> for i16

Source§

impl StrictCast<Wrapping<u64>> for i32

Source§

impl StrictCast<Wrapping<u64>> for i64

Source§

impl StrictCast<Wrapping<u64>> for i128

Source§

impl StrictCast<Wrapping<u64>> for isize

Source§

impl StrictCast<Wrapping<u64>> for u8

Source§

impl StrictCast<Wrapping<u64>> for u16

Source§

impl StrictCast<Wrapping<u64>> for u32

Source§

impl StrictCast<Wrapping<u64>> for u64

Source§

impl StrictCast<Wrapping<u64>> for u128

Source§

impl StrictCast<Wrapping<u64>> for usize

Source§

impl StrictCast<Wrapping<u128>> for bool

Source§

impl StrictCast<Wrapping<u128>> for f32

Source§

impl StrictCast<Wrapping<u128>> for f64

Source§

impl StrictCast<Wrapping<u128>> for i8

Source§

impl StrictCast<Wrapping<u128>> for i16

Source§

impl StrictCast<Wrapping<u128>> for i32

Source§

impl StrictCast<Wrapping<u128>> for i64

Source§

impl StrictCast<Wrapping<u128>> for i128

Source§

impl StrictCast<Wrapping<u128>> for isize

Source§

impl StrictCast<Wrapping<u128>> for u8

Source§

impl StrictCast<Wrapping<u128>> for u16

Source§

impl StrictCast<Wrapping<u128>> for u32

Source§

impl StrictCast<Wrapping<u128>> for u64

Source§

impl StrictCast<Wrapping<u128>> for u128

Source§

impl StrictCast<Wrapping<u128>> for usize

Source§

impl StrictCast<Wrapping<usize>> for bool

Source§

impl StrictCast<Wrapping<usize>> for f32

Source§

impl StrictCast<Wrapping<usize>> for f64

Source§

impl StrictCast<Wrapping<usize>> for i8

Source§

impl StrictCast<Wrapping<usize>> for i16

Source§

impl StrictCast<Wrapping<usize>> for i32

Source§

impl StrictCast<Wrapping<usize>> for i64

Source§

impl StrictCast<Wrapping<usize>> for i128

Source§

impl StrictCast<Wrapping<usize>> for isize

Source§

impl StrictCast<Wrapping<usize>> for u8

Source§

impl StrictCast<Wrapping<usize>> for u16

Source§

impl StrictCast<Wrapping<usize>> for u32

Source§

impl StrictCast<Wrapping<usize>> for u64

Source§

impl StrictCast<Wrapping<usize>> for u128

Source§

impl StrictCast<Wrapping<usize>> for usize

Implementors§

Source§

impl StrictCast<i8> for Round<f32>

Source§

impl StrictCast<i8> for Round<f64>

Source§

impl StrictCast<i16> for Round<f32>

Source§

impl StrictCast<i16> for Round<f64>

Source§

impl StrictCast<i32> for Round<f32>

Source§

impl StrictCast<i32> for Round<f64>

Source§

impl StrictCast<i64> for Round<f32>

Source§

impl StrictCast<i64> for Round<f64>

Source§

impl StrictCast<i128> for Round<f32>

Source§

impl StrictCast<i128> for Round<f64>

Source§

impl StrictCast<isize> for Round<f32>

Source§

impl StrictCast<isize> for Round<f64>

Source§

impl StrictCast<u8> for Round<f32>

Source§

impl StrictCast<u8> for Round<f64>

Source§

impl StrictCast<u16> for Round<f32>

Source§

impl StrictCast<u16> for Round<f64>

Source§

impl StrictCast<u32> for Round<f32>

Source§

impl StrictCast<u32> for Round<f64>

Source§

impl StrictCast<u64> for Round<f32>

Source§

impl StrictCast<u64> for Round<f64>

Source§

impl StrictCast<u128> for Round<f32>

Source§

impl StrictCast<u128> for Round<f64>

Source§

impl StrictCast<usize> for Round<f32>

Source§

impl StrictCast<usize> for Round<f64>

Source§

impl StrictCast<Wrapping<i8>> for Round<f32>

Source§

impl StrictCast<Wrapping<i8>> for Round<f64>

Source§

impl StrictCast<Wrapping<i16>> for Round<f32>

Source§

impl StrictCast<Wrapping<i16>> for Round<f64>

Source§

impl StrictCast<Wrapping<i32>> for Round<f32>

Source§

impl StrictCast<Wrapping<i32>> for Round<f64>

Source§

impl StrictCast<Wrapping<i64>> for Round<f32>

Source§

impl StrictCast<Wrapping<i64>> for Round<f64>

Source§

impl StrictCast<Wrapping<i128>> for Round<f32>

Source§

impl StrictCast<Wrapping<i128>> for Round<f64>

Source§

impl StrictCast<Wrapping<isize>> for Round<f32>

Source§

impl StrictCast<Wrapping<isize>> for Round<f64>

Source§

impl StrictCast<Wrapping<u8>> for Round<f32>

Source§

impl StrictCast<Wrapping<u8>> for Round<f64>

Source§

impl StrictCast<Wrapping<u16>> for Round<f32>

Source§

impl StrictCast<Wrapping<u16>> for Round<f64>

Source§

impl StrictCast<Wrapping<u32>> for Round<f32>

Source§

impl StrictCast<Wrapping<u32>> for Round<f64>

Source§

impl StrictCast<Wrapping<u64>> for Round<f32>

Source§

impl StrictCast<Wrapping<u64>> for Round<f64>

Source§

impl StrictCast<Wrapping<u128>> for Round<f32>

Source§

impl StrictCast<Wrapping<u128>> for Round<f64>

Source§

impl StrictCast<Wrapping<usize>> for Round<f32>

Source§

impl StrictCast<Wrapping<usize>> for Round<f64>