#byte #structs #binary-data #safety #procedural #derive #structured

macro bytes-cast-derive

Safely re-interpreting &[u8] bytes as custom structs without copying, for efficiently reading structured binary data. Procedural macro for compile-time soundness checking.

4 releases

0.2.0 Jan 10, 2023
0.1.2 Jan 10, 2023
0.1.1 Apr 8, 2021
0.1.0 Jan 15, 2021

#93 in #safety

Download history 480/week @ 2024-11-17 330/week @ 2024-11-24 461/week @ 2024-12-01 555/week @ 2024-12-08 430/week @ 2024-12-15 209/week @ 2024-12-22 395/week @ 2024-12-29 719/week @ 2025-01-05 546/week @ 2025-01-12 477/week @ 2025-01-19 585/week @ 2025-01-26 1446/week @ 2025-02-02 2469/week @ 2025-02-09 3346/week @ 2025-02-16 2997/week @ 2025-02-23 1583/week @ 2025-03-02

10,526 downloads per month
Used in bytes-cast

Zlib OR Apache-2.0 OR MIT

7KB
71 lines

bytes-cast-derive

The #[derive(BytesCast)] procedural macro for the bytes-cast crate. This statically checks the safety invariants required of custom structs.

This crate contains code derived from https://github.com/Lokathor/bytemuck.

Dependencies

~1.5MB
~38K SLoC