pub trait U32Packer {
// Required methods
fn pack_u32(first: u32, second: u32) -> Self;
fn unpack_u32(&self) -> (u32, u32);
}Expand description
Trait for packing and unpacking two u32 values into a single value.
Required Methods§
Sourcefn pack_u32(first: u32, second: u32) -> Self
fn pack_u32(first: u32, second: u32) -> Self
Packs two u32 values into a single value of the implementing type.
§Example
use num_packer::U32Packer;
let packed = u64::pack_u32(200, 55);
assert_eq!(packed, (200u64 << 32) + 55);Sourcefn unpack_u32(&self) -> (u32, u32)
fn unpack_u32(&self) -> (u32, u32)
Unpacks the single value back into two u32 values.
§Example
use num_packer::U32Packer;
let packed = u64::pack_u32(200, 55);
let (first, second) = packed.unpack_u32();
assert_eq!((first, second), (200, 55));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.