pub trait Id:
Copy
+ Clone
+ PartialOrd
+ Ord
+ PartialEq
+ Eq
+ Hash
+ Debug {
type Ty: Copy + Clone + Default + Debug + Display + Ord + PartialOrd + Eq + PartialEq + Hash + ToU64 + From<u8> + Add<Output = Self::Ty> + AddAssign<Self::Ty> + Sub<Output = Self::Ty> + SubAssign<Self::Ty> + Mul<Output = Self::Ty> + MulAssign<Self::Ty> + Div<Output = Self::Ty> + DivAssign<Self::Ty> + BitOr<Output = Self::Ty> + BitOrAssign<Self::Ty> + BitAnd<Output = Self::Ty> + BitAndAssign<Self::Ty> + BitXor<Output = Self::Ty> + BitXorAssign<Self::Ty> + Not<Output = Self::Ty> + Shl<u8, Output = Self::Ty> + Shr<u8, Output = Self::Ty> + Shl<u32, Output = Self::Ty> + Shr<u32, Output = Self::Ty> + Shl<u64, Output = Self::Ty> + Shr<u64, Output = Self::Ty> + Shl<u128, Output = Self::Ty> + Shr<u128, Output = Self::Ty> + Shl<usize, Output = Self::Ty> + Shr<usize, Output = Self::Ty> + ShlAssign<Self::Ty> + ShrAssign<Self::Ty>;
const ZERO: Self::Ty;
const ONE: Self::Ty;
// Required methods
fn to_raw(&self) -> Self::Ty;
fn from_raw(raw: Self::Ty) -> Self;
}Expand description
A trait for types that wrap a primitive scalar identifier.
This is used to abstract over the raw scalar type behind an ID (e.g., u64,
u128).
Types implementing Id must define a scalar type Ty and provide
conversion to/from this raw representation.
Required Associated Constants§
Required Associated Types§
Sourcetype Ty: Copy + Clone + Default + Debug + Display + Ord + PartialOrd + Eq + PartialEq + Hash + ToU64 + From<u8> + Add<Output = Self::Ty> + AddAssign<Self::Ty> + Sub<Output = Self::Ty> + SubAssign<Self::Ty> + Mul<Output = Self::Ty> + MulAssign<Self::Ty> + Div<Output = Self::Ty> + DivAssign<Self::Ty> + BitOr<Output = Self::Ty> + BitOrAssign<Self::Ty> + BitAnd<Output = Self::Ty> + BitAndAssign<Self::Ty> + BitXor<Output = Self::Ty> + BitXorAssign<Self::Ty> + Not<Output = Self::Ty> + Shl<u8, Output = Self::Ty> + Shr<u8, Output = Self::Ty> + Shl<u32, Output = Self::Ty> + Shr<u32, Output = Self::Ty> + Shl<u64, Output = Self::Ty> + Shr<u64, Output = Self::Ty> + Shl<u128, Output = Self::Ty> + Shr<u128, Output = Self::Ty> + Shl<usize, Output = Self::Ty> + Shr<usize, Output = Self::Ty> + ShlAssign<Self::Ty> + ShrAssign<Self::Ty>
type Ty: Copy + Clone + Default + Debug + Display + Ord + PartialOrd + Eq + PartialEq + Hash + ToU64 + From<u8> + Add<Output = Self::Ty> + AddAssign<Self::Ty> + Sub<Output = Self::Ty> + SubAssign<Self::Ty> + Mul<Output = Self::Ty> + MulAssign<Self::Ty> + Div<Output = Self::Ty> + DivAssign<Self::Ty> + BitOr<Output = Self::Ty> + BitOrAssign<Self::Ty> + BitAnd<Output = Self::Ty> + BitAndAssign<Self::Ty> + BitXor<Output = Self::Ty> + BitXorAssign<Self::Ty> + Not<Output = Self::Ty> + Shl<u8, Output = Self::Ty> + Shr<u8, Output = Self::Ty> + Shl<u32, Output = Self::Ty> + Shr<u32, Output = Self::Ty> + Shl<u64, Output = Self::Ty> + Shr<u64, Output = Self::Ty> + Shl<u128, Output = Self::Ty> + Shr<u128, Output = Self::Ty> + Shl<usize, Output = Self::Ty> + Shr<usize, Output = Self::Ty> + ShlAssign<Self::Ty> + ShrAssign<Self::Ty>
Scalar type for all bit fields (typically u64 or u128)
Required 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.