[][src]Trait az::CheckedCast

pub trait CheckedCast<Dst> {
    fn checked_cast(self) -> Option<Dst>;
}

Used for checked casts.

This trait’s method returns None if the value does not fit.

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

Examples

use az::CheckedCast;
use core::f32;

let a: Option<u32> = 5i32.checked_cast();
assert_eq!(a, Some(5));
assert_eq!(CheckedCast::<u32>::checked_cast(-5i32), None);
assert_eq!(CheckedCast::<u8>::checked_cast(17.1f32), Some(17));
let b: Option<u8> = f32::NAN.checked_cast();
assert_eq!(b, None);

Required methods

fn checked_cast(self) -> Option<Dst>

Casts the value.

Loading content...

Implementors

impl CheckedCast<Wrapping<i8>> for bool[src]

impl CheckedCast<Wrapping<i8>> for isize[src]

impl CheckedCast<Wrapping<i8>> for usize[src]

impl CheckedCast<Wrapping<i16>> for bool[src]

impl CheckedCast<Wrapping<i16>> for isize[src]

impl CheckedCast<Wrapping<i16>> for usize[src]

impl CheckedCast<Wrapping<i32>> for bool[src]

impl CheckedCast<Wrapping<i32>> for isize[src]

impl CheckedCast<Wrapping<i32>> for usize[src]

impl CheckedCast<Wrapping<i64>> for bool[src]

impl CheckedCast<Wrapping<i64>> for isize[src]

impl CheckedCast<Wrapping<i64>> for usize[src]

impl CheckedCast<Wrapping<i128>> for bool[src]

impl CheckedCast<Wrapping<i128>> for isize[src]

impl CheckedCast<Wrapping<i128>> for usize[src]

impl CheckedCast<Wrapping<i128>> for Round<f32>[src]

impl CheckedCast<Wrapping<i128>> for Round<f64>[src]

impl CheckedCast<Wrapping<i128>> for f32[src]

impl CheckedCast<Wrapping<i128>> for f64[src]

impl CheckedCast<Wrapping<i128>> for i8[src]

impl CheckedCast<Wrapping<i128>> for i16[src]

impl CheckedCast<Wrapping<i128>> for i32[src]

impl CheckedCast<Wrapping<i128>> for i64[src]

impl CheckedCast<Wrapping<i128>> for i128[src]

impl CheckedCast<Wrapping<i128>> for u8[src]

impl CheckedCast<Wrapping<i128>> for u16[src]

impl CheckedCast<Wrapping<i128>> for u32[src]

impl CheckedCast<Wrapping<i128>> for u64[src]

impl CheckedCast<Wrapping<i128>> for u128[src]

impl CheckedCast<Wrapping<i16>> for Round<f32>[src]

impl CheckedCast<Wrapping<i16>> for Round<f64>[src]

impl CheckedCast<Wrapping<i16>> for f32[src]

impl CheckedCast<Wrapping<i16>> for f64[src]

impl CheckedCast<Wrapping<i16>> for i8[src]

impl CheckedCast<Wrapping<i16>> for i16[src]

impl CheckedCast<Wrapping<i16>> for i32[src]

impl CheckedCast<Wrapping<i16>> for i64[src]

impl CheckedCast<Wrapping<i16>> for i128[src]

impl CheckedCast<Wrapping<i16>> for u8[src]

impl CheckedCast<Wrapping<i16>> for u16[src]

impl CheckedCast<Wrapping<i16>> for u32[src]

impl CheckedCast<Wrapping<i16>> for u64[src]

impl CheckedCast<Wrapping<i16>> for u128[src]

impl CheckedCast<Wrapping<i32>> for Round<f32>[src]

impl CheckedCast<Wrapping<i32>> for Round<f64>[src]

impl CheckedCast<Wrapping<i32>> for f32[src]

impl CheckedCast<Wrapping<i32>> for f64[src]

impl CheckedCast<Wrapping<i32>> for i8[src]

impl CheckedCast<Wrapping<i32>> for i16[src]

impl CheckedCast<Wrapping<i32>> for i32[src]

impl CheckedCast<Wrapping<i32>> for i64[src]

impl CheckedCast<Wrapping<i32>> for i128[src]

impl CheckedCast<Wrapping<i32>> for u8[src]

impl CheckedCast<Wrapping<i32>> for u16[src]

impl CheckedCast<Wrapping<i32>> for u32[src]

impl CheckedCast<Wrapping<i32>> for u64[src]

impl CheckedCast<Wrapping<i32>> for u128[src]

impl CheckedCast<Wrapping<i64>> for Round<f32>[src]

impl CheckedCast<Wrapping<i64>> for Round<f64>[src]

impl CheckedCast<Wrapping<i64>> for f32[src]

impl CheckedCast<Wrapping<i64>> for f64[src]

impl CheckedCast<Wrapping<i64>> for i8[src]

impl CheckedCast<Wrapping<i64>> for i16[src]

impl CheckedCast<Wrapping<i64>> for i32[src]

impl CheckedCast<Wrapping<i64>> for i64[src]

impl CheckedCast<Wrapping<i64>> for i128[src]

impl CheckedCast<Wrapping<i64>> for u8[src]

impl CheckedCast<Wrapping<i64>> for u16[src]

impl CheckedCast<Wrapping<i64>> for u32[src]

impl CheckedCast<Wrapping<i64>> for u64[src]

impl CheckedCast<Wrapping<i64>> for u128[src]

impl CheckedCast<Wrapping<i8>> for Round<f32>[src]

impl CheckedCast<Wrapping<i8>> for Round<f64>[src]

impl CheckedCast<Wrapping<i8>> for f32[src]

impl CheckedCast<Wrapping<i8>> for f64[src]

impl CheckedCast<Wrapping<i8>> for i8[src]

impl CheckedCast<Wrapping<i8>> for i16[src]

impl CheckedCast<Wrapping<i8>> for i32[src]

impl CheckedCast<Wrapping<i8>> for i64[src]

impl CheckedCast<Wrapping<i8>> for i128[src]

impl CheckedCast<Wrapping<i8>> for u8[src]

impl CheckedCast<Wrapping<i8>> for u16[src]

impl CheckedCast<Wrapping<i8>> for u32[src]

impl CheckedCast<Wrapping<i8>> for u64[src]

impl CheckedCast<Wrapping<i8>> for u128[src]

impl CheckedCast<Wrapping<isize>> for Round<f32>[src]

impl CheckedCast<Wrapping<isize>> for Round<f64>[src]

impl CheckedCast<Wrapping<isize>> for bool[src]

impl CheckedCast<Wrapping<isize>> for f32[src]

impl CheckedCast<Wrapping<isize>> for f64[src]

impl CheckedCast<Wrapping<isize>> for i8[src]

impl CheckedCast<Wrapping<isize>> for i16[src]

impl CheckedCast<Wrapping<isize>> for i32[src]

impl CheckedCast<Wrapping<isize>> for i64[src]

impl CheckedCast<Wrapping<isize>> for i128[src]

impl CheckedCast<Wrapping<isize>> for isize[src]

impl CheckedCast<Wrapping<isize>> for u8[src]

impl CheckedCast<Wrapping<isize>> for u16[src]

impl CheckedCast<Wrapping<isize>> for u32[src]

impl CheckedCast<Wrapping<isize>> for u64[src]

impl CheckedCast<Wrapping<isize>> for u128[src]

impl CheckedCast<Wrapping<isize>> for usize[src]

impl CheckedCast<Wrapping<u8>> for bool[src]

impl CheckedCast<Wrapping<u8>> for isize[src]

impl CheckedCast<Wrapping<u8>> for usize[src]

impl CheckedCast<Wrapping<u16>> for bool[src]

impl CheckedCast<Wrapping<u16>> for isize[src]

impl CheckedCast<Wrapping<u16>> for usize[src]

impl CheckedCast<Wrapping<u32>> for bool[src]

impl CheckedCast<Wrapping<u32>> for isize[src]

impl CheckedCast<Wrapping<u32>> for usize[src]

impl CheckedCast<Wrapping<u64>> for bool[src]

impl CheckedCast<Wrapping<u64>> for isize[src]

impl CheckedCast<Wrapping<u64>> for usize[src]

impl CheckedCast<Wrapping<u128>> for bool[src]

impl CheckedCast<Wrapping<u128>> for isize[src]

impl CheckedCast<Wrapping<u128>> for usize[src]

impl CheckedCast<Wrapping<u128>> for Round<f32>[src]

impl CheckedCast<Wrapping<u128>> for Round<f64>[src]

impl CheckedCast<Wrapping<u128>> for f32[src]

impl CheckedCast<Wrapping<u128>> for f64[src]

impl CheckedCast<Wrapping<u128>> for i8[src]

impl CheckedCast<Wrapping<u128>> for i16[src]

impl CheckedCast<Wrapping<u128>> for i32[src]

impl CheckedCast<Wrapping<u128>> for i64[src]

impl CheckedCast<Wrapping<u128>> for i128[src]

impl CheckedCast<Wrapping<u128>> for u8[src]

impl CheckedCast<Wrapping<u128>> for u16[src]

impl CheckedCast<Wrapping<u128>> for u32[src]

impl CheckedCast<Wrapping<u128>> for u64[src]

impl CheckedCast<Wrapping<u128>> for u128[src]

impl CheckedCast<Wrapping<u16>> for Round<f32>[src]

impl CheckedCast<Wrapping<u16>> for Round<f64>[src]

impl CheckedCast<Wrapping<u16>> for f32[src]

impl CheckedCast<Wrapping<u16>> for f64[src]

impl CheckedCast<Wrapping<u16>> for i8[src]

impl CheckedCast<Wrapping<u16>> for i16[src]

impl CheckedCast<Wrapping<u16>> for i32[src]

impl CheckedCast<Wrapping<u16>> for i64[src]

impl CheckedCast<Wrapping<u16>> for i128[src]

impl CheckedCast<Wrapping<u16>> for u8[src]

impl CheckedCast<Wrapping<u16>> for u16[src]

impl CheckedCast<Wrapping<u16>> for u32[src]

impl CheckedCast<Wrapping<u16>> for u64[src]

impl CheckedCast<Wrapping<u16>> for u128[src]

impl CheckedCast<Wrapping<u32>> for Round<f32>[src]

impl CheckedCast<Wrapping<u32>> for Round<f64>[src]

impl CheckedCast<Wrapping<u32>> for f32[src]

impl CheckedCast<Wrapping<u32>> for f64[src]

impl CheckedCast<Wrapping<u32>> for i8[src]

impl CheckedCast<Wrapping<u32>> for i16[src]

impl CheckedCast<Wrapping<u32>> for i32[src]

impl CheckedCast<Wrapping<u32>> for i64[src]

impl CheckedCast<Wrapping<u32>> for i128[src]

impl CheckedCast<Wrapping<u32>> for u8[src]

impl CheckedCast<Wrapping<u32>> for u16[src]

impl CheckedCast<Wrapping<u32>> for u32[src]

impl CheckedCast<Wrapping<u32>> for u64[src]

impl CheckedCast<Wrapping<u32>> for u128[src]

impl CheckedCast<Wrapping<u64>> for Round<f32>[src]

impl CheckedCast<Wrapping<u64>> for Round<f64>[src]

impl CheckedCast<Wrapping<u64>> for f32[src]

impl CheckedCast<Wrapping<u64>> for f64[src]

impl CheckedCast<Wrapping<u64>> for i8[src]

impl CheckedCast<Wrapping<u64>> for i16[src]

impl CheckedCast<Wrapping<u64>> for i32[src]

impl CheckedCast<Wrapping<u64>> for i64[src]

impl CheckedCast<Wrapping<u64>> for i128[src]

impl CheckedCast<Wrapping<u64>> for u8[src]

impl CheckedCast<Wrapping<u64>> for u16[src]

impl CheckedCast<Wrapping<u64>> for u32[src]

impl CheckedCast<Wrapping<u64>> for u64[src]

impl CheckedCast<Wrapping<u64>> for u128[src]

impl CheckedCast<Wrapping<u8>> for Round<f32>[src]

impl CheckedCast<Wrapping<u8>> for Round<f64>[src]

impl CheckedCast<Wrapping<u8>> for f32[src]

impl CheckedCast<Wrapping<u8>> for f64[src]

impl CheckedCast<Wrapping<u8>> for i8[src]

impl CheckedCast<Wrapping<u8>> for i16[src]

impl CheckedCast<Wrapping<u8>> for i32[src]

impl CheckedCast<Wrapping<u8>> for i64[src]

impl CheckedCast<Wrapping<u8>> for i128[src]

impl CheckedCast<Wrapping<u8>> for u8[src]

impl CheckedCast<Wrapping<u8>> for u16[src]

impl CheckedCast<Wrapping<u8>> for u32[src]

impl CheckedCast<Wrapping<u8>> for u64[src]

impl CheckedCast<Wrapping<u8>> for u128[src]

impl CheckedCast<Wrapping<usize>> for Round<f32>[src]

impl CheckedCast<Wrapping<usize>> for Round<f64>[src]

impl CheckedCast<Wrapping<usize>> for bool[src]

impl CheckedCast<Wrapping<usize>> for f32[src]

impl CheckedCast<Wrapping<usize>> for f64[src]

impl CheckedCast<Wrapping<usize>> for i8[src]

impl CheckedCast<Wrapping<usize>> for i16[src]

impl CheckedCast<Wrapping<usize>> for i32[src]

impl CheckedCast<Wrapping<usize>> for i64[src]

impl CheckedCast<Wrapping<usize>> for i128[src]

impl CheckedCast<Wrapping<usize>> for isize[src]

impl CheckedCast<Wrapping<usize>> for u8[src]

impl CheckedCast<Wrapping<usize>> for u16[src]

impl CheckedCast<Wrapping<usize>> for u32[src]

impl CheckedCast<Wrapping<usize>> for u64[src]

impl CheckedCast<Wrapping<usize>> for u128[src]

impl CheckedCast<Wrapping<usize>> for usize[src]

impl CheckedCast<f32> for isize[src]

impl CheckedCast<f32> for usize[src]

impl CheckedCast<f64> for isize[src]

impl CheckedCast<f64> for usize[src]

impl CheckedCast<f32> for f32[src]

impl CheckedCast<f32> for f64[src]

impl CheckedCast<f32> for i8[src]

impl CheckedCast<f32> for i16[src]

impl CheckedCast<f32> for i32[src]

impl CheckedCast<f32> for i64[src]

impl CheckedCast<f32> for i128[src]

impl CheckedCast<f32> for u8[src]

impl CheckedCast<f32> for u16[src]

impl CheckedCast<f32> for u32[src]

impl CheckedCast<f32> for u64[src]

impl CheckedCast<f32> for u128[src]

impl CheckedCast<f64> for f32[src]

impl CheckedCast<f64> for f64[src]

impl CheckedCast<f64> for i8[src]

impl CheckedCast<f64> for i16[src]

impl CheckedCast<f64> for i32[src]

impl CheckedCast<f64> for i64[src]

impl CheckedCast<f64> for i128[src]

impl CheckedCast<f64> for u8[src]

impl CheckedCast<f64> for u16[src]

impl CheckedCast<f64> for u32[src]

impl CheckedCast<f64> for u64[src]

impl CheckedCast<f64> for u128[src]

impl CheckedCast<i8> for bool[src]

impl CheckedCast<i8> for isize[src]

impl CheckedCast<i8> for usize[src]

impl CheckedCast<i16> for bool[src]

impl CheckedCast<i16> for isize[src]

impl CheckedCast<i16> for usize[src]

impl CheckedCast<i32> for bool[src]

impl CheckedCast<i32> for isize[src]

impl CheckedCast<i32> for usize[src]

impl CheckedCast<i64> for bool[src]

impl CheckedCast<i64> for isize[src]

impl CheckedCast<i64> for usize[src]

impl CheckedCast<i128> for bool[src]

impl CheckedCast<i128> for isize[src]

impl CheckedCast<i128> for usize[src]

impl CheckedCast<i128> for Round<f32>[src]

impl CheckedCast<i128> for Round<f64>[src]

impl CheckedCast<i128> for f32[src]

impl CheckedCast<i128> for f64[src]

impl CheckedCast<i128> for i8[src]

impl CheckedCast<i128> for i16[src]

impl CheckedCast<i128> for i32[src]

impl CheckedCast<i128> for i64[src]

impl CheckedCast<i128> for i128[src]

impl CheckedCast<i128> for u8[src]

impl CheckedCast<i128> for u16[src]

impl CheckedCast<i128> for u32[src]

impl CheckedCast<i128> for u64[src]

impl CheckedCast<i128> for u128[src]

impl CheckedCast<i16> for Round<f32>[src]

impl CheckedCast<i16> for Round<f64>[src]

impl CheckedCast<i16> for f32[src]

impl CheckedCast<i16> for f64[src]

impl CheckedCast<i16> for i8[src]

impl CheckedCast<i16> for i16[src]

impl CheckedCast<i16> for i32[src]

impl CheckedCast<i16> for i64[src]

impl CheckedCast<i16> for i128[src]

impl CheckedCast<i16> for u8[src]

impl CheckedCast<i16> for u16[src]

impl CheckedCast<i16> for u32[src]

impl CheckedCast<i16> for u64[src]

impl CheckedCast<i16> for u128[src]

impl CheckedCast<i32> for Round<f32>[src]

impl CheckedCast<i32> for Round<f64>[src]

impl CheckedCast<i32> for f32[src]

impl CheckedCast<i32> for f64[src]

impl CheckedCast<i32> for i8[src]

impl CheckedCast<i32> for i16[src]

impl CheckedCast<i32> for i32[src]

impl CheckedCast<i32> for i64[src]

impl CheckedCast<i32> for i128[src]

impl CheckedCast<i32> for u8[src]

impl CheckedCast<i32> for u16[src]

impl CheckedCast<i32> for u32[src]

impl CheckedCast<i32> for u64[src]

impl CheckedCast<i32> for u128[src]

impl CheckedCast<i64> for Round<f32>[src]

impl CheckedCast<i64> for Round<f64>[src]

impl CheckedCast<i64> for f32[src]

impl CheckedCast<i64> for f64[src]

impl CheckedCast<i64> for i8[src]

impl CheckedCast<i64> for i16[src]

impl CheckedCast<i64> for i32[src]

impl CheckedCast<i64> for i64[src]

impl CheckedCast<i64> for i128[src]

impl CheckedCast<i64> for u8[src]

impl CheckedCast<i64> for u16[src]

impl CheckedCast<i64> for u32[src]

impl CheckedCast<i64> for u64[src]

impl CheckedCast<i64> for u128[src]

impl CheckedCast<i8> for Round<f32>[src]

impl CheckedCast<i8> for Round<f64>[src]

impl CheckedCast<i8> for f32[src]

impl CheckedCast<i8> for f64[src]

impl CheckedCast<i8> for i8[src]

impl CheckedCast<i8> for i16[src]

impl CheckedCast<i8> for i32[src]

impl CheckedCast<i8> for i64[src]

impl CheckedCast<i8> for i128[src]

impl CheckedCast<i8> for u8[src]

impl CheckedCast<i8> for u16[src]

impl CheckedCast<i8> for u32[src]

impl CheckedCast<i8> for u64[src]

impl CheckedCast<i8> for u128[src]

impl CheckedCast<isize> for Round<f32>[src]

impl CheckedCast<isize> for Round<f64>[src]

impl CheckedCast<isize> for bool[src]

impl CheckedCast<isize> for f32[src]

impl CheckedCast<isize> for f64[src]

impl CheckedCast<isize> for i8[src]

impl CheckedCast<isize> for i16[src]

impl CheckedCast<isize> for i32[src]

impl CheckedCast<isize> for i64[src]

impl CheckedCast<isize> for i128[src]

impl CheckedCast<isize> for isize[src]

impl CheckedCast<isize> for u8[src]

impl CheckedCast<isize> for u16[src]

impl CheckedCast<isize> for u32[src]

impl CheckedCast<isize> for u64[src]

impl CheckedCast<isize> for u128[src]

impl CheckedCast<isize> for usize[src]

impl CheckedCast<u8> for bool[src]

impl CheckedCast<u8> for isize[src]

impl CheckedCast<u8> for usize[src]

impl CheckedCast<u16> for bool[src]

impl CheckedCast<u16> for isize[src]

impl CheckedCast<u16> for usize[src]

impl CheckedCast<u32> for bool[src]

impl CheckedCast<u32> for isize[src]

impl CheckedCast<u32> for usize[src]

impl CheckedCast<u64> for bool[src]

impl CheckedCast<u64> for isize[src]

impl CheckedCast<u64> for usize[src]

impl CheckedCast<u128> for bool[src]

impl CheckedCast<u128> for isize[src]

impl CheckedCast<u128> for usize[src]

impl CheckedCast<u128> for Round<f32>[src]

impl CheckedCast<u128> for Round<f64>[src]

impl CheckedCast<u128> for f32[src]

impl CheckedCast<u128> for f64[src]

impl CheckedCast<u128> for i8[src]

impl CheckedCast<u128> for i16[src]

impl CheckedCast<u128> for i32[src]

impl CheckedCast<u128> for i64[src]

impl CheckedCast<u128> for i128[src]

impl CheckedCast<u128> for u8[src]

impl CheckedCast<u128> for u16[src]

impl CheckedCast<u128> for u32[src]

impl CheckedCast<u128> for u64[src]

impl CheckedCast<u128> for u128[src]

impl CheckedCast<u16> for Round<f32>[src]

impl CheckedCast<u16> for Round<f64>[src]

impl CheckedCast<u16> for f32[src]

impl CheckedCast<u16> for f64[src]

impl CheckedCast<u16> for i8[src]

impl CheckedCast<u16> for i16[src]

impl CheckedCast<u16> for i32[src]

impl CheckedCast<u16> for i64[src]

impl CheckedCast<u16> for i128[src]

impl CheckedCast<u16> for u8[src]

impl CheckedCast<u16> for u16[src]

impl CheckedCast<u16> for u32[src]

impl CheckedCast<u16> for u64[src]

impl CheckedCast<u16> for u128[src]

impl CheckedCast<u32> for Round<f32>[src]

impl CheckedCast<u32> for Round<f64>[src]

impl CheckedCast<u32> for f32[src]

impl CheckedCast<u32> for f64[src]

impl CheckedCast<u32> for i8[src]

impl CheckedCast<u32> for i16[src]

impl CheckedCast<u32> for i32[src]

impl CheckedCast<u32> for i64[src]

impl CheckedCast<u32> for i128[src]

impl CheckedCast<u32> for u8[src]

impl CheckedCast<u32> for u16[src]

impl CheckedCast<u32> for u32[src]

impl CheckedCast<u32> for u64[src]

impl CheckedCast<u32> for u128[src]

impl CheckedCast<u64> for Round<f32>[src]

impl CheckedCast<u64> for Round<f64>[src]

impl CheckedCast<u64> for f32[src]

impl CheckedCast<u64> for f64[src]

impl CheckedCast<u64> for i8[src]

impl CheckedCast<u64> for i16[src]

impl CheckedCast<u64> for i32[src]

impl CheckedCast<u64> for i64[src]

impl CheckedCast<u64> for i128[src]

impl CheckedCast<u64> for u8[src]

impl CheckedCast<u64> for u16[src]

impl CheckedCast<u64> for u32[src]

impl CheckedCast<u64> for u64[src]

impl CheckedCast<u64> for u128[src]

impl CheckedCast<u8> for Round<f32>[src]

impl CheckedCast<u8> for Round<f64>[src]

impl CheckedCast<u8> for f32[src]

impl CheckedCast<u8> for f64[src]

impl CheckedCast<u8> for i8[src]

impl CheckedCast<u8> for i16[src]

impl CheckedCast<u8> for i32[src]

impl CheckedCast<u8> for i64[src]

impl CheckedCast<u8> for i128[src]

impl CheckedCast<u8> for u8[src]

impl CheckedCast<u8> for u16[src]

impl CheckedCast<u8> for u32[src]

impl CheckedCast<u8> for u64[src]

impl CheckedCast<u8> for u128[src]

impl CheckedCast<usize> for Round<f32>[src]

impl CheckedCast<usize> for Round<f64>[src]

impl CheckedCast<usize> for bool[src]

impl CheckedCast<usize> for f32[src]

impl CheckedCast<usize> for f64[src]

impl CheckedCast<usize> for i8[src]

impl CheckedCast<usize> for i16[src]

impl CheckedCast<usize> for i32[src]

impl CheckedCast<usize> for i64[src]

impl CheckedCast<usize> for i128[src]

impl CheckedCast<usize> for isize[src]

impl CheckedCast<usize> for u8[src]

impl CheckedCast<usize> for u16[src]

impl CheckedCast<usize> for u32[src]

impl CheckedCast<usize> for u64[src]

impl CheckedCast<usize> for u128[src]

impl CheckedCast<usize> for usize[src]

Loading content...