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.14"
no_std:
toml
[dependencies]
deku = { version = "0.14", 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, }
fn main() {
let data: Vec
val.field_c = 0xC0FE;
let data_out = val.to_bytes().unwrap();
assert_eq!(vec![0b0110_1001, 0xC0, 0xFE], data_out);
} ```
See CHANGELOG.md