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