pub trait UncheckedPrimitiveInt: Sized {
Show 25 methods
// Required methods
fn from_u8_unchecked(n: u8) -> Self;
fn from_i8_unchecked(n: i8) -> Self;
fn from_u16_unchecked(n: u16) -> Self;
fn from_i16_unchecked(n: i16) -> Self;
fn from_u32_unchecked(n: u32) -> Self;
fn from_i32_unchecked(n: i32) -> Self;
fn from_u64_unchecked(n: u64) -> Self;
fn from_i64_unchecked(n: i64) -> Self;
fn from_u128_unchecked(n: u128) -> Self;
fn from_i128_unchecked(n: i128) -> Self;
fn from_usize_unchecked(n: usize) -> Self;
fn from_isize_unchecked(n: isize) -> Self;
fn into_u8_unchecked(self) -> u8;
fn into_i8_unchecked(self) -> i8;
fn into_u16_unchecked(self) -> u16;
fn into_i16_unchecked(self) -> i16;
fn into_u32_unchecked(self) -> u32;
fn into_i32_unchecked(self) -> i32;
fn into_u64_unchecked(self) -> u64;
fn into_i64_unchecked(self) -> i64;
fn into_u128_unchecked(self) -> u128;
fn into_i128_unchecked(self) -> i128;
fn into_usize_unchecked(self) -> usize;
fn into_isize_unchecked(self) -> isize;
fn from_unchecked<N: UncheckedPrimitiveInt>(n: N) -> Self;
}
Expand description
Allow casting integers unchecked
Required Methods§
Sourcefn from_u8_unchecked(n: u8) -> Self
fn from_u8_unchecked(n: u8) -> Self
Cast from u8, truncating if needed
Sourcefn from_i8_unchecked(n: i8) -> Self
fn from_i8_unchecked(n: i8) -> Self
Cast from i8, truncating if needed
Sourcefn from_u16_unchecked(n: u16) -> Self
fn from_u16_unchecked(n: u16) -> Self
Cast from u16, truncating if needed
Sourcefn from_i16_unchecked(n: i16) -> Self
fn from_i16_unchecked(n: i16) -> Self
Cast from i16, truncating if needed
Sourcefn from_u32_unchecked(n: u32) -> Self
fn from_u32_unchecked(n: u32) -> Self
Cast from u32, truncating if needed
Sourcefn from_i32_unchecked(n: i32) -> Self
fn from_i32_unchecked(n: i32) -> Self
Cast from i32, truncating if needed
Sourcefn from_u64_unchecked(n: u64) -> Self
fn from_u64_unchecked(n: u64) -> Self
Cast from u64, truncating if needed
Sourcefn from_i64_unchecked(n: i64) -> Self
fn from_i64_unchecked(n: i64) -> Self
Cast from i64, truncating if needed
Sourcefn from_u128_unchecked(n: u128) -> Self
fn from_u128_unchecked(n: u128) -> Self
Cast from u128, truncating if needed
Sourcefn from_i128_unchecked(n: i128) -> Self
fn from_i128_unchecked(n: i128) -> Self
Cast from i128, truncating if needed
Sourcefn from_usize_unchecked(n: usize) -> Self
fn from_usize_unchecked(n: usize) -> Self
Cast from usize, truncating if needed
Sourcefn from_isize_unchecked(n: isize) -> Self
fn from_isize_unchecked(n: isize) -> Self
Cast from isize, truncating if needed
Sourcefn into_u8_unchecked(self) -> u8
fn into_u8_unchecked(self) -> u8
Cast from u8, truncating if needed
Sourcefn into_i8_unchecked(self) -> i8
fn into_i8_unchecked(self) -> i8
Cast from i8, truncating if needed
Sourcefn into_u16_unchecked(self) -> u16
fn into_u16_unchecked(self) -> u16
Cast from u16, truncating if needed
Sourcefn into_i16_unchecked(self) -> i16
fn into_i16_unchecked(self) -> i16
Cast from i16, truncating if needed
Sourcefn into_u32_unchecked(self) -> u32
fn into_u32_unchecked(self) -> u32
Cast from u32, truncating if needed
Sourcefn into_i32_unchecked(self) -> i32
fn into_i32_unchecked(self) -> i32
Cast from i32, truncating if needed
Sourcefn into_u64_unchecked(self) -> u64
fn into_u64_unchecked(self) -> u64
Cast from u64, truncating if needed
Sourcefn into_i64_unchecked(self) -> i64
fn into_i64_unchecked(self) -> i64
Cast from i64, truncating if needed
Sourcefn into_u128_unchecked(self) -> u128
fn into_u128_unchecked(self) -> u128
Cast from u128, truncating if needed
Sourcefn into_i128_unchecked(self) -> i128
fn into_i128_unchecked(self) -> i128
Cast from i128, truncating if needed
Sourcefn into_usize_unchecked(self) -> usize
fn into_usize_unchecked(self) -> usize
Cast from usize, truncating if needed
Sourcefn into_isize_unchecked(self) -> isize
fn into_isize_unchecked(self) -> isize
Cast from isize, truncating if needed
Sourcefn from_unchecked<N: UncheckedPrimitiveInt>(n: N) -> Self
fn from_unchecked<N: UncheckedPrimitiveInt>(n: N) -> Self
Cast any int to any int, truncating if needed
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.