Trait az::OverflowingCast

source ·
pub trait OverflowingCast<Dst> {
    // Required method
    fn overflowing_cast(self) -> (Dst, bool);
}
Expand description

Used for overflowing casts.

This trait’s method returns a [tuple] of the value and a [bool], indicating whether an overflow has occurred. On overflow, the wrapped value is returned.

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

§Examples

use az::OverflowingCast;
let a: (u8, bool) = 17i32.overflowing_cast();
assert_eq!(a, (17, false));
assert_eq!(OverflowingCast::<u32>::overflowing_cast(-1), (u32::max_value(), true));
assert_eq!(OverflowingCast::<u8>::overflowing_cast(17.0 + 256.0), (17, true));

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

Required Methods§

source

fn overflowing_cast(self) -> (Dst, bool)

Casts the value.

Implementations on Foreign Types§

source§

impl OverflowingCast<i8> for bool

source§

fn overflowing_cast(self) -> (i8, bool)

source§

impl OverflowingCast<i8> for f32

source§

fn overflowing_cast(self) -> (i8, bool)

source§

impl OverflowingCast<i8> for f64

source§

fn overflowing_cast(self) -> (i8, bool)

source§

impl OverflowingCast<i8> for i8

source§

fn overflowing_cast(self) -> (i8, bool)

source§

impl OverflowingCast<i8> for i16

source§

fn overflowing_cast(self) -> (i8, bool)

source§

impl OverflowingCast<i8> for i32

source§

fn overflowing_cast(self) -> (i8, bool)

source§

impl OverflowingCast<i8> for i64

source§

fn overflowing_cast(self) -> (i8, bool)

source§

impl OverflowingCast<i8> for i128

source§

fn overflowing_cast(self) -> (i8, bool)

source§

impl OverflowingCast<i8> for isize

source§

fn overflowing_cast(self) -> (i8, bool)

source§

impl OverflowingCast<i8> for u8

source§

fn overflowing_cast(self) -> (i8, bool)

source§

impl OverflowingCast<i8> for u16

source§

fn overflowing_cast(self) -> (i8, bool)

source§

impl OverflowingCast<i8> for u32

source§

fn overflowing_cast(self) -> (i8, bool)

source§

impl OverflowingCast<i8> for u64

source§

fn overflowing_cast(self) -> (i8, bool)

source§

impl OverflowingCast<i8> for u128

source§

fn overflowing_cast(self) -> (i8, bool)

source§

impl OverflowingCast<i8> for usize

source§

fn overflowing_cast(self) -> (i8, bool)

source§

impl OverflowingCast<i16> for bool

source§

fn overflowing_cast(self) -> (i16, bool)

source§

impl OverflowingCast<i16> for f32

source§

fn overflowing_cast(self) -> (i16, bool)

source§

impl OverflowingCast<i16> for f64

source§

fn overflowing_cast(self) -> (i16, bool)

source§

impl OverflowingCast<i16> for i8

source§

fn overflowing_cast(self) -> (i16, bool)

source§

impl OverflowingCast<i16> for i16

source§

fn overflowing_cast(self) -> (i16, bool)

source§

impl OverflowingCast<i16> for i32

source§

fn overflowing_cast(self) -> (i16, bool)

source§

impl OverflowingCast<i16> for i64

source§

fn overflowing_cast(self) -> (i16, bool)

source§

impl OverflowingCast<i16> for i128

source§

fn overflowing_cast(self) -> (i16, bool)

source§

impl OverflowingCast<i16> for isize

source§

fn overflowing_cast(self) -> (i16, bool)

source§

impl OverflowingCast<i16> for u8

source§

fn overflowing_cast(self) -> (i16, bool)

source§

impl OverflowingCast<i16> for u16

source§

fn overflowing_cast(self) -> (i16, bool)

source§

impl OverflowingCast<i16> for u32

source§

fn overflowing_cast(self) -> (i16, bool)

source§

impl OverflowingCast<i16> for u64

source§

fn overflowing_cast(self) -> (i16, bool)

source§

impl OverflowingCast<i16> for u128

source§

fn overflowing_cast(self) -> (i16, bool)

source§

impl OverflowingCast<i16> for usize

source§

fn overflowing_cast(self) -> (i16, bool)

source§

impl OverflowingCast<i32> for bool

source§

fn overflowing_cast(self) -> (i32, bool)

source§

impl OverflowingCast<i32> for f32

source§

fn overflowing_cast(self) -> (i32, bool)

source§

impl OverflowingCast<i32> for f64

source§

fn overflowing_cast(self) -> (i32, bool)

source§

impl OverflowingCast<i32> for i8

source§

fn overflowing_cast(self) -> (i32, bool)

source§

impl OverflowingCast<i32> for i16

source§

fn overflowing_cast(self) -> (i32, bool)

source§

impl OverflowingCast<i32> for i32

source§

fn overflowing_cast(self) -> (i32, bool)

source§

impl OverflowingCast<i32> for i64

source§

fn overflowing_cast(self) -> (i32, bool)

source§

impl OverflowingCast<i32> for i128

source§

fn overflowing_cast(self) -> (i32, bool)

source§

impl OverflowingCast<i32> for isize

source§

fn overflowing_cast(self) -> (i32, bool)

source§

impl OverflowingCast<i32> for u8

source§

fn overflowing_cast(self) -> (i32, bool)

source§

impl OverflowingCast<i32> for u16

source§

fn overflowing_cast(self) -> (i32, bool)

source§

impl OverflowingCast<i32> for u32

source§

fn overflowing_cast(self) -> (i32, bool)

source§

impl OverflowingCast<i32> for u64

source§

fn overflowing_cast(self) -> (i32, bool)

source§

impl OverflowingCast<i32> for u128

source§

fn overflowing_cast(self) -> (i32, bool)

source§

impl OverflowingCast<i32> for usize

source§

fn overflowing_cast(self) -> (i32, bool)

source§

impl OverflowingCast<i64> for bool

source§

fn overflowing_cast(self) -> (i64, bool)

source§

impl OverflowingCast<i64> for f32

source§

fn overflowing_cast(self) -> (i64, bool)

source§

impl OverflowingCast<i64> for f64

source§

fn overflowing_cast(self) -> (i64, bool)

source§

impl OverflowingCast<i64> for i8

source§

fn overflowing_cast(self) -> (i64, bool)

source§

impl OverflowingCast<i64> for i16

source§

fn overflowing_cast(self) -> (i64, bool)

source§

impl OverflowingCast<i64> for i32

source§

fn overflowing_cast(self) -> (i64, bool)

source§

impl OverflowingCast<i64> for i64

source§

fn overflowing_cast(self) -> (i64, bool)

source§

impl OverflowingCast<i64> for i128

source§

fn overflowing_cast(self) -> (i64, bool)

source§

impl OverflowingCast<i64> for isize

source§

fn overflowing_cast(self) -> (i64, bool)

source§

impl OverflowingCast<i64> for u8

source§

fn overflowing_cast(self) -> (i64, bool)

source§

impl OverflowingCast<i64> for u16

source§

fn overflowing_cast(self) -> (i64, bool)

source§

impl OverflowingCast<i64> for u32

source§

fn overflowing_cast(self) -> (i64, bool)

source§

impl OverflowingCast<i64> for u64

source§

fn overflowing_cast(self) -> (i64, bool)

source§

impl OverflowingCast<i64> for u128

source§

fn overflowing_cast(self) -> (i64, bool)

source§

impl OverflowingCast<i64> for usize

source§

fn overflowing_cast(self) -> (i64, bool)

source§

impl OverflowingCast<i128> for bool

source§

fn overflowing_cast(self) -> (i128, bool)

source§

impl OverflowingCast<i128> for f32

source§

fn overflowing_cast(self) -> (i128, bool)

source§

impl OverflowingCast<i128> for f64

source§

fn overflowing_cast(self) -> (i128, bool)

source§

impl OverflowingCast<i128> for i8

source§

fn overflowing_cast(self) -> (i128, bool)

source§

impl OverflowingCast<i128> for i16

source§

fn overflowing_cast(self) -> (i128, bool)

source§

impl OverflowingCast<i128> for i32

source§

fn overflowing_cast(self) -> (i128, bool)

source§

impl OverflowingCast<i128> for i64

source§

fn overflowing_cast(self) -> (i128, bool)

source§

impl OverflowingCast<i128> for i128

source§

fn overflowing_cast(self) -> (i128, bool)

source§

impl OverflowingCast<i128> for isize

source§

fn overflowing_cast(self) -> (i128, bool)

source§

impl OverflowingCast<i128> for u8

source§

fn overflowing_cast(self) -> (i128, bool)

source§

impl OverflowingCast<i128> for u16

source§

fn overflowing_cast(self) -> (i128, bool)

source§

impl OverflowingCast<i128> for u32

source§

fn overflowing_cast(self) -> (i128, bool)

source§

impl OverflowingCast<i128> for u64

source§

fn overflowing_cast(self) -> (i128, bool)

source§

impl OverflowingCast<i128> for u128

source§

fn overflowing_cast(self) -> (i128, bool)

source§

impl OverflowingCast<i128> for usize

source§

fn overflowing_cast(self) -> (i128, bool)

source§

impl OverflowingCast<isize> for bool

source§

fn overflowing_cast(self) -> (isize, bool)

source§

impl OverflowingCast<isize> for f32

source§

fn overflowing_cast(self) -> (isize, bool)

source§

impl OverflowingCast<isize> for f64

source§

fn overflowing_cast(self) -> (isize, bool)

source§

impl OverflowingCast<isize> for i8

source§

fn overflowing_cast(self) -> (isize, bool)

source§

impl OverflowingCast<isize> for i16

source§

fn overflowing_cast(self) -> (isize, bool)

source§

impl OverflowingCast<isize> for i32

source§

fn overflowing_cast(self) -> (isize, bool)

source§

impl OverflowingCast<isize> for i64

source§

fn overflowing_cast(self) -> (isize, bool)

source§

impl OverflowingCast<isize> for i128

source§

fn overflowing_cast(self) -> (isize, bool)

source§

impl OverflowingCast<isize> for isize

source§

fn overflowing_cast(self) -> (isize, bool)

source§

impl OverflowingCast<isize> for u8

source§

fn overflowing_cast(self) -> (isize, bool)

source§

impl OverflowingCast<isize> for u16

source§

fn overflowing_cast(self) -> (isize, bool)

source§

impl OverflowingCast<isize> for u32

source§

fn overflowing_cast(self) -> (isize, bool)

source§

impl OverflowingCast<isize> for u64

source§

fn overflowing_cast(self) -> (isize, bool)

source§

impl OverflowingCast<isize> for u128

source§

fn overflowing_cast(self) -> (isize, bool)

source§

impl OverflowingCast<isize> for usize

source§

fn overflowing_cast(self) -> (isize, bool)

source§

impl OverflowingCast<u8> for bool

source§

fn overflowing_cast(self) -> (u8, bool)

source§

impl OverflowingCast<u8> for f32

source§

fn overflowing_cast(self) -> (u8, bool)

source§

impl OverflowingCast<u8> for f64

source§

fn overflowing_cast(self) -> (u8, bool)

source§

impl OverflowingCast<u8> for i8

source§

fn overflowing_cast(self) -> (u8, bool)

source§

impl OverflowingCast<u8> for i16

source§

fn overflowing_cast(self) -> (u8, bool)

source§

impl OverflowingCast<u8> for i32

source§

fn overflowing_cast(self) -> (u8, bool)

source§

impl OverflowingCast<u8> for i64

source§

fn overflowing_cast(self) -> (u8, bool)

source§

impl OverflowingCast<u8> for i128

source§

fn overflowing_cast(self) -> (u8, bool)

source§

impl OverflowingCast<u8> for isize

source§

fn overflowing_cast(self) -> (u8, bool)

source§

impl OverflowingCast<u8> for u8

source§

fn overflowing_cast(self) -> (u8, bool)

source§

impl OverflowingCast<u8> for u16

source§

fn overflowing_cast(self) -> (u8, bool)

source§

impl OverflowingCast<u8> for u32

source§

fn overflowing_cast(self) -> (u8, bool)

source§

impl OverflowingCast<u8> for u64

source§

fn overflowing_cast(self) -> (u8, bool)

source§

impl OverflowingCast<u8> for u128

source§

fn overflowing_cast(self) -> (u8, bool)

source§

impl OverflowingCast<u8> for usize

source§

fn overflowing_cast(self) -> (u8, bool)

source§

impl OverflowingCast<u16> for bool

source§

fn overflowing_cast(self) -> (u16, bool)

source§

impl OverflowingCast<u16> for f32

source§

fn overflowing_cast(self) -> (u16, bool)

source§

impl OverflowingCast<u16> for f64

source§

fn overflowing_cast(self) -> (u16, bool)

source§

impl OverflowingCast<u16> for i8

source§

fn overflowing_cast(self) -> (u16, bool)

source§

impl OverflowingCast<u16> for i16

source§

fn overflowing_cast(self) -> (u16, bool)

source§

impl OverflowingCast<u16> for i32

source§

fn overflowing_cast(self) -> (u16, bool)

source§

impl OverflowingCast<u16> for i64

source§

fn overflowing_cast(self) -> (u16, bool)

source§

impl OverflowingCast<u16> for i128

source§

fn overflowing_cast(self) -> (u16, bool)

source§

impl OverflowingCast<u16> for isize

source§

fn overflowing_cast(self) -> (u16, bool)

source§

impl OverflowingCast<u16> for u8

source§

fn overflowing_cast(self) -> (u16, bool)

source§

impl OverflowingCast<u16> for u16

source§

fn overflowing_cast(self) -> (u16, bool)

source§

impl OverflowingCast<u16> for u32

source§

fn overflowing_cast(self) -> (u16, bool)

source§

impl OverflowingCast<u16> for u64

source§

fn overflowing_cast(self) -> (u16, bool)

source§

impl OverflowingCast<u16> for u128

source§

fn overflowing_cast(self) -> (u16, bool)

source§

impl OverflowingCast<u16> for usize

source§

fn overflowing_cast(self) -> (u16, bool)

source§

impl OverflowingCast<u32> for bool

source§

fn overflowing_cast(self) -> (u32, bool)

source§

impl OverflowingCast<u32> for f32

source§

fn overflowing_cast(self) -> (u32, bool)

source§

impl OverflowingCast<u32> for f64

source§

fn overflowing_cast(self) -> (u32, bool)

source§

impl OverflowingCast<u32> for i8

source§

fn overflowing_cast(self) -> (u32, bool)

source§

impl OverflowingCast<u32> for i16

source§

fn overflowing_cast(self) -> (u32, bool)

source§

impl OverflowingCast<u32> for i32

source§

fn overflowing_cast(self) -> (u32, bool)

source§

impl OverflowingCast<u32> for i64

source§

fn overflowing_cast(self) -> (u32, bool)

source§

impl OverflowingCast<u32> for i128

source§

fn overflowing_cast(self) -> (u32, bool)

source§

impl OverflowingCast<u32> for isize

source§

fn overflowing_cast(self) -> (u32, bool)

source§

impl OverflowingCast<u32> for u8

source§

fn overflowing_cast(self) -> (u32, bool)

source§

impl OverflowingCast<u32> for u16

source§

fn overflowing_cast(self) -> (u32, bool)

source§

impl OverflowingCast<u32> for u32

source§

fn overflowing_cast(self) -> (u32, bool)

source§

impl OverflowingCast<u32> for u64

source§

fn overflowing_cast(self) -> (u32, bool)

source§

impl OverflowingCast<u32> for u128

source§

fn overflowing_cast(self) -> (u32, bool)

source§

impl OverflowingCast<u32> for usize

source§

fn overflowing_cast(self) -> (u32, bool)

source§

impl OverflowingCast<u64> for bool

source§

fn overflowing_cast(self) -> (u64, bool)

source§

impl OverflowingCast<u64> for f32

source§

fn overflowing_cast(self) -> (u64, bool)

source§

impl OverflowingCast<u64> for f64

source§

fn overflowing_cast(self) -> (u64, bool)

source§

impl OverflowingCast<u64> for i8

source§

fn overflowing_cast(self) -> (u64, bool)

source§

impl OverflowingCast<u64> for i16

source§

fn overflowing_cast(self) -> (u64, bool)

source§

impl OverflowingCast<u64> for i32

source§

fn overflowing_cast(self) -> (u64, bool)

source§

impl OverflowingCast<u64> for i64

source§

fn overflowing_cast(self) -> (u64, bool)

source§

impl OverflowingCast<u64> for i128

source§

fn overflowing_cast(self) -> (u64, bool)

source§

impl OverflowingCast<u64> for isize

source§

fn overflowing_cast(self) -> (u64, bool)

source§

impl OverflowingCast<u64> for u8

source§

fn overflowing_cast(self) -> (u64, bool)

source§

impl OverflowingCast<u64> for u16

source§

fn overflowing_cast(self) -> (u64, bool)

source§

impl OverflowingCast<u64> for u32

source§

fn overflowing_cast(self) -> (u64, bool)

source§

impl OverflowingCast<u64> for u64

source§

fn overflowing_cast(self) -> (u64, bool)

source§

impl OverflowingCast<u64> for u128

source§

fn overflowing_cast(self) -> (u64, bool)

source§

impl OverflowingCast<u64> for usize

source§

fn overflowing_cast(self) -> (u64, bool)

source§

impl OverflowingCast<u128> for bool

source§

fn overflowing_cast(self) -> (u128, bool)

source§

impl OverflowingCast<u128> for f32

source§

fn overflowing_cast(self) -> (u128, bool)

source§

impl OverflowingCast<u128> for f64

source§

fn overflowing_cast(self) -> (u128, bool)

source§

impl OverflowingCast<u128> for i8

source§

fn overflowing_cast(self) -> (u128, bool)

source§

impl OverflowingCast<u128> for i16

source§

fn overflowing_cast(self) -> (u128, bool)

source§

impl OverflowingCast<u128> for i32

source§

fn overflowing_cast(self) -> (u128, bool)

source§

impl OverflowingCast<u128> for i64

source§

fn overflowing_cast(self) -> (u128, bool)

source§

impl OverflowingCast<u128> for i128

source§

fn overflowing_cast(self) -> (u128, bool)

source§

impl OverflowingCast<u128> for isize

source§

fn overflowing_cast(self) -> (u128, bool)

source§

impl OverflowingCast<u128> for u8

source§

fn overflowing_cast(self) -> (u128, bool)

source§

impl OverflowingCast<u128> for u16

source§

fn overflowing_cast(self) -> (u128, bool)

source§

impl OverflowingCast<u128> for u32

source§

fn overflowing_cast(self) -> (u128, bool)

source§

impl OverflowingCast<u128> for u64

source§

fn overflowing_cast(self) -> (u128, bool)

source§

impl OverflowingCast<u128> for u128

source§

fn overflowing_cast(self) -> (u128, bool)

source§

impl OverflowingCast<u128> for usize

source§

fn overflowing_cast(self) -> (u128, bool)

source§

impl OverflowingCast<usize> for bool

source§

fn overflowing_cast(self) -> (usize, bool)

source§

impl OverflowingCast<usize> for f32

source§

fn overflowing_cast(self) -> (usize, bool)

source§

impl OverflowingCast<usize> for f64

source§

fn overflowing_cast(self) -> (usize, bool)

source§

impl OverflowingCast<usize> for i8

source§

fn overflowing_cast(self) -> (usize, bool)

source§

impl OverflowingCast<usize> for i16

source§

fn overflowing_cast(self) -> (usize, bool)

source§

impl OverflowingCast<usize> for i32

source§

fn overflowing_cast(self) -> (usize, bool)

source§

impl OverflowingCast<usize> for i64

source§

fn overflowing_cast(self) -> (usize, bool)

source§

impl OverflowingCast<usize> for i128

source§

fn overflowing_cast(self) -> (usize, bool)

source§

impl OverflowingCast<usize> for isize

source§

fn overflowing_cast(self) -> (usize, bool)

source§

impl OverflowingCast<usize> for u8

source§

fn overflowing_cast(self) -> (usize, bool)

source§

impl OverflowingCast<usize> for u16

source§

fn overflowing_cast(self) -> (usize, bool)

source§

impl OverflowingCast<usize> for u32

source§

fn overflowing_cast(self) -> (usize, bool)

source§

impl OverflowingCast<usize> for u64

source§

fn overflowing_cast(self) -> (usize, bool)

source§

impl OverflowingCast<usize> for u128

source§

fn overflowing_cast(self) -> (usize, bool)

source§

impl OverflowingCast<usize> for usize

source§

fn overflowing_cast(self) -> (usize, bool)

Implementors§

source§

impl OverflowingCast<i8> for Round<f32>

source§

impl OverflowingCast<i8> for Round<f64>

source§

impl OverflowingCast<i16> for Round<f32>

source§

impl OverflowingCast<i16> for Round<f64>

source§

impl OverflowingCast<i32> for Round<f32>

source§

impl OverflowingCast<i32> for Round<f64>

source§

impl OverflowingCast<i64> for Round<f32>

source§

impl OverflowingCast<i64> for Round<f64>

source§

impl OverflowingCast<i128> for Round<f32>

source§

impl OverflowingCast<i128> for Round<f64>

source§

impl OverflowingCast<isize> for Round<f32>

source§

impl OverflowingCast<isize> for Round<f64>

source§

impl OverflowingCast<u8> for Round<f32>

source§

impl OverflowingCast<u8> for Round<f64>

source§

impl OverflowingCast<u16> for Round<f32>

source§

impl OverflowingCast<u16> for Round<f64>

source§

impl OverflowingCast<u32> for Round<f32>

source§

impl OverflowingCast<u32> for Round<f64>

source§

impl OverflowingCast<u64> for Round<f32>

source§

impl OverflowingCast<u64> for Round<f64>

source§

impl OverflowingCast<u128> for Round<f32>

source§

impl OverflowingCast<u128> for Round<f64>

source§

impl OverflowingCast<usize> for Round<f32>

source§

impl OverflowingCast<usize> for Round<f64>