Deserializing Binary Data Files in Rust
adventures.michaelfbryan.com
adventures.michaelfbryan.com
From their website:
> Kaitai Struct is a declarative language used to describe various binary data structures, laid out in files or in memory: i.e. binary file formats, network stream packet formats, etc.
They even have a Rust interface: https://github.com/kaitai-io/kaitai_struct_rust_runtime
The one possible issue is that reading padding is UB (i think). But here there should be no padding: the struct is a pair number of bytes (alignment 1) and a word (alignment 2), which us aligned due to the previous, and the struct is if alignment 2.
How does one calculate this offset based on the fields in the struct?