3 releases (1 stable)

1.0.0 Nov 26, 2023
0.1.1 Mar 30, 2023
0.1.0 Mar 30, 2023

#1082 in Rust patterns

Download history 7/week @ 2023-12-11 14/week @ 2023-12-18 1/week @ 2023-12-25 6/week @ 2024-01-08 7/week @ 2024-01-15 3/week @ 2024-01-22 9/week @ 2024-02-05 14/week @ 2024-02-12 78/week @ 2024-02-19 65/week @ 2024-02-26 21/week @ 2024-03-04 12/week @ 2024-03-11 10/week @ 2024-03-18

109 downloads per month
Used in imagine

Zlib OR Apache-2.0 OR MIT

25KB
838 lines

Docs.rs

pack1

Byte array newtypes for different primitive types.


lib.rs:

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.

Dependencies

~150KB