3 releases (1 stable)

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

#1411 in Rust patterns

Download history 15/week @ 2024-08-10 6/week @ 2024-08-17 1/week @ 2024-08-24 16/week @ 2024-08-31 21/week @ 2024-09-07 16/week @ 2024-09-14 27/week @ 2024-09-21 20/week @ 2024-09-28 6/week @ 2024-10-05 14/week @ 2024-10-12 9/week @ 2024-10-19 18/week @ 2024-10-26 21/week @ 2024-11-02 4/week @ 2024-11-09 11/week @ 2024-11-16 14/week @ 2024-11-23

55 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

~135KB