pub trait NInt: PrimInt + CheckedShl + BitOrAssign + ShlAssign<usize> + Debug + Display + Binary + Send + Sync + 'static {
type Bytes: AsRef<[u8]> + AsMut<[u8]> + Default + Clone + Copy;
const BYTE_SIZE: usize;
// Required methods
fn from_u64(u: u64) -> Self;
fn from_u8(u: u8) -> Self;
fn from_be_bytes(b: Self::Bytes) -> Self;
// Provided methods
fn empty_byte_array() -> Self::Bytes { ... }
fn zigzag_decode(self) -> Self { ... }
fn decode_signed_from_msb(self, _encoded_byte_size: usize) -> Self { ... }
}
Expand description
Helps generalise the decoder efforts to be specific to supported integers. (Instead of decoding to u64/i64 for all then downcasting).
Required Associated Types§
Required Associated Constants§
Required Methods§
Provided Methods§
fn empty_byte_array() -> Self::Bytes
fn zigzag_decode(self) -> Self
fn decode_signed_from_msb(self, _encoded_byte_size: usize) -> Self
Object Safety§
This trait is not object safe.