3 releases (1 stable)

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

#1461 in Rust patterns

Download history 6/week @ 2024-07-22 21/week @ 2024-07-29 13/week @ 2024-08-05 16/week @ 2024-08-12 3/week @ 2024-08-19 24/week @ 2024-09-02 18/week @ 2024-09-09 15/week @ 2024-09-16 27/week @ 2024-09-23 21/week @ 2024-09-30 3/week @ 2024-10-07 13/week @ 2024-10-14 10/week @ 2024-10-21 23/week @ 2024-10-28 16/week @ 2024-11-04

63 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

~140KB