simple_parse

crates.io mio Lines of Code

This crate is heavily based of deku with the bit level precision removed.

Usage

```Rust use simple_parse::{SpRead, SpWrite};

[derive(Debug, SpRead, SpWrite)]

pub struct SomeStruct { somefield: u8, numitems: u16, #[sp(count="num_items", endian="big")] items: Vec, }

/// <...>

// Parse arbitrary byte buffer into our struct let (rest, mut res) = SomeStruct::frombytes(byteslice)?; /// Modify the struct res.dwords.push(0x12345678); /// Dump modified struct into Vec let generatedbytes = res.tobytes()?;

```

For complete examples see : examples