pub trait Numeric {
Show 28 associated items
type AsU8;
type AsU16;
type AsU32;
type AsU64;
type AsU128;
type AsUSize;
type AsI8;
type AsI16;
type AsI32;
type AsI64;
type AsI128;
type AsISize;
type AsF32;
type AsF64;
// Required methods
fn to_u8(self) -> Self::AsU8;
fn to_u16(self) -> Self::AsU16;
fn to_u32(self) -> Self::AsU32;
fn to_u64(self) -> Self::AsU64;
fn to_u128(self) -> Self::AsU128;
fn to_usize(self) -> Self::AsUSize;
fn to_i8(self) -> Self::AsI8;
fn to_i16(self) -> Self::AsI16;
fn to_i32(self) -> Self::AsI32;
fn to_i64(self) -> Self::AsI64;
fn to_i128(self) -> Self::AsI128;
fn to_isize(self) -> Self::AsISize;
fn to_f32(self) -> Self::AsF32;
fn to_f64(self) -> Self::AsF64;
}Expand description
A numeric type that can be casted.
Since all components of this type are the same primitive number type, we can provide methods to cast the entire object to different ones.
Required Associated Types§
type AsU8
type AsU16
type AsU32
type AsU64
type AsU128
type AsUSize
type AsI8
type AsI16
type AsI32
type AsI64
type AsI128
type AsISize
type AsF32
type AsF64
Required Methods§
fn to_u8(self) -> Self::AsU8
fn to_u16(self) -> Self::AsU16
fn to_u32(self) -> Self::AsU32
fn to_u64(self) -> Self::AsU64
fn to_u128(self) -> Self::AsU128
fn to_usize(self) -> Self::AsUSize
fn to_i8(self) -> Self::AsI8
fn to_i16(self) -> Self::AsI16
fn to_i32(self) -> Self::AsI32
fn to_i64(self) -> Self::AsI64
fn to_i128(self) -> Self::AsI128
fn to_isize(self) -> Self::AsISize
fn to_f32(self) -> Self::AsF32
fn to_f64(self) -> Self::AsF64
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".