pub trait U8Packer {
// Required methods
fn pack_u8(first: u8, second: u8) -> Self;
fn first_u8(&self) -> u8;
fn second_u8(&self) -> u8;
// Provided method
fn unpack_u8(&self) -> (u8, u8) { ... }
}Expand description
Trait for packing and unpacking two u8 values into a single value.
Required Methods§
Sourcefn pack_u8(first: u8, second: u8) -> Self
fn pack_u8(first: u8, second: u8) -> Self
Packs two u8 values into a single value of the implementing type.
§Example
use num_packer::U8Packer;
let packed = u16::pack_u8(200, 55);
assert_eq!(packed, (200 << 8) + 55);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.