3 releases
Uses new Rust 2024
| 0.1.2 | Sep 14, 2025 |
|---|---|
| 0.1.1 | Sep 14, 2025 |
| 0.1.0 | Sep 13, 2025 |
#998 in Encoding
65 downloads per month
23KB
261 lines
num-packer
Provides traits and implementations for packing and unpacking two numbers into a single value.
Example
Pack two u8 into u16.
use num_packer::U8Packer;
let packed = u16::pack_u8(200, 55);
let (first, second) = packed.unpack_u8();
assert_eq!((first, second), (200, 55));
Implementations
- Pack two
boolintou8/i8,u16/i16,u32/i32,u64/i64,usize/isize - Pack two
u8intou16/i16,u32/i32,u64/i64,usize/isize - Pack two
u16intou32/i32,u64/i64,usize/isize(if target pointer width is 32 or 64) - Pack two
u32intou64/i64,usize/isize(if target pointer width is 64) - Pack two
i8intou16/i16,u32/i32,u64/i64,usize/isize - Pack two
i16intou32/i32,u64/i64,usize/isize(if target pointer width is 32 or 64) - Pack two
i32intou64/i64,usize/isize(if target pointer width is 64) - Pack two
f32intou64/i64,usize/isize(if target pointer width is 64)
License
This project is licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.