Declarative binary reading and writing
This crate provides bit-level, symmetric, serialization/deserialization implementations for structs and enums
Productivity: Deku will generate symmetric reader/writer functions for your type! Avoid the requirement of writing redundant, error-prone parsing and writing code for binary structs or network headers
toml
[dependencies]
deku = "0.7"
no_std:
toml
[dependencies]
deku = { version = "0.7", default-features = false, features = ["alloc"] }
See documentation or examples folder for more!
Read big-endian data into a struct, modify a value, and write it
```rust use deku::prelude::*;
struct DekuTest { #[deku(bits = "4")] fielda: u8, #[deku(bits = "4")] fieldb: u8, field_c: u16, }
let data: Vec
val.field_c = 0xC0FE;
let dataout = val.tobytes().unwrap(); asserteq!(vec![0b01101001, 0xC0, 0xFE], data_out); ```
See CHANGELOG.md