pub trait NumberLike:
Primitive
+ Copy
+ Default
+ FromStr
+ PartialEq
+ PartialOrd
+ Debug
+ Display
+ Unpin
+ UnwindSafe
+ RefUnwindSafe
+ Send
+ Sync
+ Sized
+ 'static {
type Underlying: Number;
type ByteArray: Array<Item = u8>;
const MIN: Self;
const MAX: Self;
Show 22 methods
// Required methods
fn to_underlying(self) -> Self::Underlying;
fn try_from_underlying(underlying: Self::Underlying) -> Option<Self>;
fn to_bytes(self) -> Self::ByteArray;
fn try_from_bytes(bytes: Self::ByteArray) -> Option<Self>;
fn to_be_bytes(self) -> Self::ByteArray;
fn to_le_bytes(self) -> Self::ByteArray;
fn to_ne_bytes(self) -> Self::ByteArray;
fn try_from_be_bytes(bytes: Self::ByteArray) -> Option<Self>;
fn try_from_le_bytes(bytes: Self::ByteArray) -> Option<Self>;
fn try_from_ne_bytes(bytes: Self::ByteArray) -> Option<Self>;
fn cast_i8(self) -> i8;
fn cast_i16(self) -> i16;
fn cast_i32(self) -> i32;
fn cast_i64(self) -> i64;
fn cast_i128(self) -> i128;
fn cast_isize(self) -> isize;
fn cast_u8(self) -> u8;
fn cast_u16(self) -> u16;
fn cast_u32(self) -> u32;
fn cast_u64(self) -> u64;
fn cast_u128(self) -> u128;
fn cast_usize(self) -> usize;
}Required Associated Constants§
Sourceconst MIN: Self
const MIN: Self
Same as the builtin MIN associated constant, except that this is
NEG_INFINITY for floats instead of the minimum
finite value.
Required Associated Types§
Required Methods§
fn to_underlying(self) -> Self::Underlying
fn try_from_underlying(underlying: Self::Underlying) -> Option<Self>
fn to_bytes(self) -> Self::ByteArray
fn try_from_bytes(bytes: Self::ByteArray) -> Option<Self>
fn to_be_bytes(self) -> Self::ByteArray
fn to_le_bytes(self) -> Self::ByteArray
fn to_ne_bytes(self) -> Self::ByteArray
fn try_from_be_bytes(bytes: Self::ByteArray) -> Option<Self>
fn try_from_le_bytes(bytes: Self::ByteArray) -> Option<Self>
fn try_from_ne_bytes(bytes: Self::ByteArray) -> Option<Self>
fn cast_i8(self) -> i8
fn cast_i16(self) -> i16
fn cast_i32(self) -> i32
fn cast_i64(self) -> i64
fn cast_i128(self) -> i128
fn cast_isize(self) -> isize
fn cast_u8(self) -> u8
fn cast_u16(self) -> u16
fn cast_u32(self) -> u32
fn cast_u64(self) -> u64
fn cast_u128(self) -> u128
fn cast_usize(self) -> usize
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.