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