Crate pack1

Source
Expand description

Byte array newtypes for different primitive types.

Because they’re newtypes of byte arrays, they always have alignment 1.

Each type has new and get functions, as well as From impls. The new and get functions are const fn with int types, but not yet with floating types.

The intended usage of this crate is that you can use these these types in a repr(C) struct, along with manual padding, and then have each field at the exact byte offset you desire (and with the necessary endian-ness), without the normal repr(packed) problem that it interferes with references.

Structs§

F32BE
Bytes for a f32, aligned to 1, big-endian.
F32LE
Bytes for a f32, aligned to 1, little-endian.
F32NE
Bytes for a f32, aligned to 1, native-endian.
F64BE
Bytes for a f64, aligned to 1, big-endian.
F64LE
Bytes for a f64, aligned to 1, little-endian.
F64NE
Bytes for a f64, aligned to 1, native-endian.
I16BE
Bytes for a i16, aligned to 1, big-endian.
I16LE
Bytes for a i16, aligned to 1, little-endian.
I16NE
Bytes for a i16, aligned to 1, native-endian.
I32BE
Bytes for a i32, aligned to 1, big-endian.
I32LE
Bytes for a i32, aligned to 1, little-endian.
I32NE
Bytes for a i32, aligned to 1, native-endian.
I64BE
Bytes for a i64, aligned to 1, big-endian.
I64LE
Bytes for a i64, aligned to 1, little-endian.
I64NE
Bytes for a i64, aligned to 1, native-endian.
U16BE
Bytes for a u16, aligned to 1, big-endian.
U16LE
Bytes for a u16, aligned to 1, little-endian.
U16NE
Bytes for a u16, aligned to 1, native-endian.
U32BE
Bytes for a u32, aligned to 1, big-endian.
U32LE
Bytes for a u32, aligned to 1, little-endian.
U32NE
Bytes for a u32, aligned to 1, native-endian.
U64BE
Bytes for a u64, aligned to 1, big-endian.
U64LE
Bytes for a u64, aligned to 1, little-endian.
U64NE
Bytes for a u64, aligned to 1, native-endian.