Deku
Declarative binary reading and writing
This crate provides bit-level, symmetric, serialization/deserialization implementations for structs and enums
Why use Deku
Productivity: Focus and declare your types that represent the data, 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
Usage
[]
= "0.2"
Example
See examples for more!
use *;
use TryFrom;
/// DekuTest Struct
// 0 1 2 3 4
// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | field_a | field_b |c| field_d | e | f |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
//
// #[deku(endian = "little")] // By default it uses the system endianness, but can be overwritten