#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

#83 in #safety

Download history 262/week @ 2024-07-24 436/week @ 2024-07-31 358/week @ 2024-08-07 453/week @ 2024-08-14 213/week @ 2024-08-21 277/week @ 2024-08-28 228/week @ 2024-09-04 478/week @ 2024-09-11 244/week @ 2024-09-18 425/week @ 2024-09-25 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 525/week @ 2024-11-06

2,078 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
~37K SLoC