pub trait PrimitiveCast {
Show 48 methods
// Required methods
fn checked_cast_to_u8(self) -> Result<u8>;
fn checked_cast_to_u16(self) -> Result<u16>;
fn checked_cast_to_u32(self) -> Result<u32>;
fn checked_cast_to_u64(self) -> Result<u64>;
fn checked_cast_to_u128(self) -> Result<u128>;
fn checked_cast_to_usize(self) -> Result<usize>;
fn checked_cast_to_usize_up(self) -> Result<usize_up>;
fn checked_cast_to_usize_down(self) -> Result<usize_down>;
fn checked_cast_to_i8(self) -> Result<i8>;
fn checked_cast_to_i16(self) -> Result<i16>;
fn checked_cast_to_i32(self) -> Result<i32>;
fn checked_cast_to_i64(self) -> Result<i64>;
fn checked_cast_to_i128(self) -> Result<i128>;
fn checked_cast_to_isize(self) -> Result<isize>;
fn checked_cast_to_isize_up(self) -> Result<isize_up>;
fn checked_cast_to_isize_down(self) -> Result<isize_down>;
fn saturating_cast_to_u8(self) -> u8;
fn saturating_cast_to_u16(self) -> u16;
fn saturating_cast_to_u32(self) -> u32 ⓘ;
fn saturating_cast_to_u64(self) -> u64;
fn saturating_cast_to_u128(self) -> u128;
fn saturating_cast_to_usize(self) -> usize;
fn saturating_cast_to_usize_up(self) -> usize_up;
fn saturating_cast_to_usize_down(self) -> usize_down;
fn saturating_cast_to_i8(self) -> i8;
fn saturating_cast_to_i16(self) -> i16;
fn saturating_cast_to_i32(self) -> i32;
fn saturating_cast_to_i64(self) -> i64 ⓘ;
fn saturating_cast_to_i128(self) -> i128;
fn saturating_cast_to_isize(self) -> isize;
fn saturating_cast_to_isize_up(self) -> isize_up;
fn saturating_cast_to_isize_down(self) -> isize_down;
fn wrapping_cast_to_u8(self) -> u8;
fn wrapping_cast_to_u16(self) -> u16;
fn wrapping_cast_to_u32(self) -> u32 ⓘ;
fn wrapping_cast_to_u64(self) -> u64;
fn wrapping_cast_to_u128(self) -> u128;
fn wrapping_cast_to_usize(self) -> usize;
fn wrapping_cast_to_usize_up(self) -> usize_up;
fn wrapping_cast_to_usize_down(self) -> usize_down;
fn wrapping_cast_to_i8(self) -> i8;
fn wrapping_cast_to_i16(self) -> i16;
fn wrapping_cast_to_i32(self) -> i32;
fn wrapping_cast_to_i64(self) -> i64 ⓘ;
fn wrapping_cast_to_i128(self) -> i128;
fn wrapping_cast_to_isize(self) -> isize;
fn wrapping_cast_to_isize_up(self) -> isize_up;
fn wrapping_cast_to_isize_down(self) -> isize_down;
}cast only.Expand description
Required Methods§
Sourcefn checked_cast_to_u8(self) -> Result<u8>
fn checked_cast_to_u8(self) -> Result<u8>
Casts self to u8 with range check.
Sourcefn checked_cast_to_u16(self) -> Result<u16>
fn checked_cast_to_u16(self) -> Result<u16>
Casts self to u16 with range check.
Sourcefn checked_cast_to_u32(self) -> Result<u32>
fn checked_cast_to_u32(self) -> Result<u32>
Casts self to u32 with range check.
Sourcefn checked_cast_to_u64(self) -> Result<u64>
fn checked_cast_to_u64(self) -> Result<u64>
Casts self to u64 with range check.
Sourcefn checked_cast_to_u128(self) -> Result<u128>
fn checked_cast_to_u128(self) -> Result<u128>
Casts self to u128 with range check.
Sourcefn checked_cast_to_usize(self) -> Result<usize>
fn checked_cast_to_usize(self) -> Result<usize>
Casts self to usize with range check.
Sourcefn checked_cast_to_usize_up(self) -> Result<usize_up>
fn checked_cast_to_usize_up(self) -> Result<usize_up>
Casts self to usize_up with range check.
Sourcefn checked_cast_to_usize_down(self) -> Result<usize_down>
fn checked_cast_to_usize_down(self) -> Result<usize_down>
Casts self to usize_down with range check.
Sourcefn checked_cast_to_i8(self) -> Result<i8>
fn checked_cast_to_i8(self) -> Result<i8>
Casts self to i8 with range check.
Sourcefn checked_cast_to_i16(self) -> Result<i16>
fn checked_cast_to_i16(self) -> Result<i16>
Casts self to i16 with range check.
Sourcefn checked_cast_to_i32(self) -> Result<i32>
fn checked_cast_to_i32(self) -> Result<i32>
Casts self to i32 with range check.
Sourcefn checked_cast_to_i64(self) -> Result<i64>
fn checked_cast_to_i64(self) -> Result<i64>
Casts self to i64 with range check.
Sourcefn checked_cast_to_i128(self) -> Result<i128>
fn checked_cast_to_i128(self) -> Result<i128>
Casts self to i128 with range check.
Sourcefn checked_cast_to_isize(self) -> Result<isize>
fn checked_cast_to_isize(self) -> Result<isize>
Casts self to isize with range check.
Sourcefn checked_cast_to_isize_up(self) -> Result<isize_up>
fn checked_cast_to_isize_up(self) -> Result<isize_up>
Casts self to isize_up with range check.
Sourcefn checked_cast_to_isize_down(self) -> Result<isize_down>
fn checked_cast_to_isize_down(self) -> Result<isize_down>
Casts self to isize_down with range check.
Sourcefn saturating_cast_to_u8(self) -> u8
fn saturating_cast_to_u8(self) -> u8
Casts self to u8 clamping at the numeric bounds.
Sourcefn saturating_cast_to_u16(self) -> u16
fn saturating_cast_to_u16(self) -> u16
Casts self to u16 clamping at the numeric bounds.
Sourcefn saturating_cast_to_u32(self) -> u32 ⓘ
fn saturating_cast_to_u32(self) -> u32 ⓘ
Casts self to u32 clamping at the numeric bounds.
Sourcefn saturating_cast_to_u64(self) -> u64
fn saturating_cast_to_u64(self) -> u64
Casts self to u64 clamping at the numeric bounds.
Sourcefn saturating_cast_to_u128(self) -> u128
fn saturating_cast_to_u128(self) -> u128
Casts self to u128 clamping at the numeric bounds.
Sourcefn saturating_cast_to_usize(self) -> usize
fn saturating_cast_to_usize(self) -> usize
Casts self to usize clamping at the numeric bounds.
Sourcefn saturating_cast_to_usize_up(self) -> usize_up
fn saturating_cast_to_usize_up(self) -> usize_up
Casts self to usize_up clamping at the numeric bounds.
Sourcefn saturating_cast_to_usize_down(self) -> usize_down
fn saturating_cast_to_usize_down(self) -> usize_down
Casts self to usize_down clamping at the numeric bounds.
Sourcefn saturating_cast_to_i8(self) -> i8
fn saturating_cast_to_i8(self) -> i8
Casts self to i8 clamping at the numeric bounds.
Sourcefn saturating_cast_to_i16(self) -> i16
fn saturating_cast_to_i16(self) -> i16
Casts self to i16 clamping at the numeric bounds.
Sourcefn saturating_cast_to_i32(self) -> i32
fn saturating_cast_to_i32(self) -> i32
Casts self to i32 clamping at the numeric bounds.
Sourcefn saturating_cast_to_i64(self) -> i64 ⓘ
fn saturating_cast_to_i64(self) -> i64 ⓘ
Casts self to i64 clamping at the numeric bounds.
Sourcefn saturating_cast_to_i128(self) -> i128
fn saturating_cast_to_i128(self) -> i128
Casts self to i128 clamping at the numeric bounds.
Sourcefn saturating_cast_to_isize(self) -> isize
fn saturating_cast_to_isize(self) -> isize
Casts self to isize clamping at the numeric bounds.
Sourcefn saturating_cast_to_isize_up(self) -> isize_up
fn saturating_cast_to_isize_up(self) -> isize_up
Casts self to isize_up clamping at the numeric bounds.
Sourcefn saturating_cast_to_isize_down(self) -> isize_down
fn saturating_cast_to_isize_down(self) -> isize_down
Casts self to isize_down clamping at the numeric bounds.
Sourcefn wrapping_cast_to_u8(self) -> u8
fn wrapping_cast_to_u8(self) -> u8
Casts self to u8 wrapping at the numeric bounds.
Sourcefn wrapping_cast_to_u16(self) -> u16
fn wrapping_cast_to_u16(self) -> u16
Casts self to u16 wrapping at the numeric bounds.
Sourcefn wrapping_cast_to_u32(self) -> u32 ⓘ
fn wrapping_cast_to_u32(self) -> u32 ⓘ
Casts self to u32 wrapping at the numeric bounds.
Sourcefn wrapping_cast_to_u64(self) -> u64
fn wrapping_cast_to_u64(self) -> u64
Casts self to u64 wrapping at the numeric bounds.
Sourcefn wrapping_cast_to_u128(self) -> u128
fn wrapping_cast_to_u128(self) -> u128
Casts self to u128 wrapping at the numeric bounds.
Sourcefn wrapping_cast_to_usize(self) -> usize
fn wrapping_cast_to_usize(self) -> usize
Casts self to usize wrapping at the numeric bounds.
Sourcefn wrapping_cast_to_usize_up(self) -> usize_up
fn wrapping_cast_to_usize_up(self) -> usize_up
Casts self to usize_up wrapping at the numeric bounds.
Sourcefn wrapping_cast_to_usize_down(self) -> usize_down
fn wrapping_cast_to_usize_down(self) -> usize_down
Casts self to usize_down wrapping at the numeric bounds.
Sourcefn wrapping_cast_to_i8(self) -> i8
fn wrapping_cast_to_i8(self) -> i8
Casts self to i8 wrapping at the numeric bounds.
Sourcefn wrapping_cast_to_i16(self) -> i16
fn wrapping_cast_to_i16(self) -> i16
Casts self to i16 wrapping at the numeric bounds.
Sourcefn wrapping_cast_to_i32(self) -> i32
fn wrapping_cast_to_i32(self) -> i32
Casts self to i32 wrapping at the numeric bounds.
Sourcefn wrapping_cast_to_i64(self) -> i64 ⓘ
fn wrapping_cast_to_i64(self) -> i64 ⓘ
Casts self to i64 wrapping at the numeric bounds.
Sourcefn wrapping_cast_to_i128(self) -> i128
fn wrapping_cast_to_i128(self) -> i128
Casts self to i128 wrapping at the numeric bounds.
Sourcefn wrapping_cast_to_isize(self) -> isize
fn wrapping_cast_to_isize(self) -> isize
Casts self to isize wrapping at the numeric bounds.
Sourcefn wrapping_cast_to_isize_up(self) -> isize_up
fn wrapping_cast_to_isize_up(self) -> isize_up
Casts self to isize_up wrapping at the numeric bounds.
Sourcefn wrapping_cast_to_isize_down(self) -> isize_down
fn wrapping_cast_to_isize_down(self) -> isize_down
Casts self to isize_down wrapping at the numeric bounds.