checked_int_cast

Trait CheckedIntCast

Source
pub trait CheckedIntCast {
    // Required methods
    fn as_isize_checked(self) -> Option<isize>;
    fn as_i8_checked(self) -> Option<i8>;
    fn as_i16_checked(self) -> Option<i16>;
    fn as_i32_checked(self) -> Option<i32>;
    fn as_i64_checked(self) -> Option<i64>;
    fn as_usize_checked(self) -> Option<usize>;
    fn as_u8_checked(self) -> Option<u8>;
    fn as_u16_checked(self) -> Option<u16>;
    fn as_u32_checked(self) -> Option<u32>;
    fn as_u64_checked(self) -> Option<u64>;
}
Expand description

This trait allows a value to be cast to the various primitive integer types. If the conversion overflows or underflows, the functions return None.

Required Methods§

Implementations on Foreign Types§

Source§

impl CheckedIntCast for i8

Source§

impl CheckedIntCast for i16

Source§

impl CheckedIntCast for i32

Source§

impl CheckedIntCast for i64

Source§

impl CheckedIntCast for isize

Source§

impl CheckedIntCast for u8

Source§

impl CheckedIntCast for u16

Source§

impl CheckedIntCast for u32

Source§

impl CheckedIntCast for u64

Source§

impl CheckedIntCast for usize

Implementors§