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;
// 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>;
}
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>
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.