#byte #structs #binary-data #procedural #safety #derive #proc-macro

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

#90 in #safety

Download history 422/week @ 2024-10-01 496/week @ 2024-10-08 351/week @ 2024-10-15 726/week @ 2024-10-22 377/week @ 2024-10-29 522/week @ 2024-11-05 657/week @ 2024-11-12 440/week @ 2024-11-19 365/week @ 2024-11-26 502/week @ 2024-12-03 528/week @ 2024-12-10 389/week @ 2024-12-17 225/week @ 2024-12-24 532/week @ 2024-12-31 638/week @ 2025-01-07 477/week @ 2025-01-14

1,918 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