#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 431/week @ 2024-10-02 463/week @ 2024-10-09 369/week @ 2024-10-16 700/week @ 2024-10-23 394/week @ 2024-10-30 542/week @ 2024-11-06 651/week @ 2024-11-13 392/week @ 2024-11-20 360/week @ 2024-11-27 530/week @ 2024-12-04 565/week @ 2024-12-11 307/week @ 2024-12-18 220/week @ 2024-12-25 655/week @ 2025-01-01 584/week @ 2025-01-08 475/week @ 2025-01-15

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