pub trait LinkReference:
Sized
+ Number
+ Unsigned
+ ToSigned
+ MaxValue
+ WrappingArithmetic
+ FromPrimitive
+ TryFrom<i8>
+ TryFrom<u8>
+ TryFrom<i16>
+ TryFrom<u16>
+ TryFrom<i32>
+ TryFrom<u32>
+ TryFrom<i64>
+ TryFrom<u64>
+ TryFrom<i128>
+ TryFrom<u128>
+ TryFrom<isize>
+ TryFrom<usize>
+ TryInto<i8>
+ TryInto<u8>
+ TryInto<i16>
+ TryInto<u16>
+ TryInto<i32>
+ TryInto<u32>
+ TryInto<i64>
+ TryInto<u64>
+ TryInto<i128>
+ TryInto<u128>
+ TryInto<isize>
+ TryInto<usize>
+ Debug
+ Display
+ Hash
+ Send
+ Sync
+ 'staticwhere
Self::Error: Debug,
Self::Error: Debug,
Self::Error: Debug,
Self::Error: Debug,
Self::Error: Debug,
Self::Error: Debug,
Self::Error: Debug,
Self::Error: Debug,
Self::Error: Debug,
Self::Error: Debug,
Self::Error: Debug,
Self::Error: Debug,
Self::Error: Debug,
Self::Error: Debug,
Self::Error: Debug,
Self::Error: Debug,
Self::Error: Debug,
Self::Error: Debug,
Self::Error: Debug,
Self::Error: Debug,
Self::Error: Debug,
Self::Error: Debug,
Self::Error: Debug,
Self::Error: Debug,{
// Provided method
fn from_byte(n: u8) -> Self { ... }
}Expand description
A composite trait for types that can be used as link identifiers.
Combines Number, Unsigned, ToSigned, MaxValue,
WrappingArithmetic, FromPrimitive,
TryFrom/TryInto for all integer types,
Debug, Display, Hash, Send, Sync, and 'static.
Implemented for u8, u16, u32, u64, u128, and usize.
§Design note
Supertraits are listed explicitly rather than via type aliases, because some IDEs do not fully resolve trait aliases for autocompletion and go-to-definition.
§Examples
use platform_num::LinkReference;
fn create_link<T: LinkReference>(source: T, target: T) -> (T, T) {
(source, target)
}
let link = create_link(1u64, 2u64);
assert_eq!(link, (1u64, 2u64));Provided Methods§
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.