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

  • Bytes for a f32, aligned to 1, big-endian.
  • Bytes for a f32, aligned to 1, little-endian.
  • Bytes for a f32, aligned to 1, native-endian.
  • Bytes for a f64, aligned to 1, big-endian.
  • Bytes for a f64, aligned to 1, little-endian.
  • Bytes for a f64, aligned to 1, native-endian.
  • Bytes for a i16, aligned to 1, big-endian.
  • Bytes for a i16, aligned to 1, little-endian.
  • Bytes for a i16, aligned to 1, native-endian.
  • Bytes for a i32, aligned to 1, big-endian.
  • Bytes for a i32, aligned to 1, little-endian.
  • Bytes for a i32, aligned to 1, native-endian.
  • Bytes for a i64, aligned to 1, big-endian.
  • Bytes for a i64, aligned to 1, little-endian.
  • Bytes for a i64, aligned to 1, native-endian.
  • Bytes for a u16, aligned to 1, big-endian.
  • Bytes for a u16, aligned to 1, little-endian.
  • Bytes for a u16, aligned to 1, native-endian.
  • Bytes for a u32, aligned to 1, big-endian.
  • Bytes for a u32, aligned to 1, little-endian.
  • Bytes for a u32, aligned to 1, native-endian.
  • Bytes for a u64, aligned to 1, big-endian.
  • Bytes for a u64, aligned to 1, little-endian.
  • Bytes for a u64, aligned to 1, native-endian.