simple_parse 0.1.0

A macro derive crate that allows conversion between arbitrary bytes into Rust types and vice-versa
Documentation

simple_parse

crates.io mio Lines of Code

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

Usage

use simple_parse::{SpRead, SpWrite};

#[derive(Debug, SpRead, SpWrite)]
pub struct SomeStruct {
    some_field: u8,
    num_dwords: u16,
    #[sp(count="num_dwords", endian="big")]
    dwords: Vec<u32>,
}

/// <...>

let (rest, mut res) = SomeStruct::from_bytes(byte_slice)?;
res.dwords.push(0x12345678);
let generated_bytes = res.to_bytes()?;

For complete examples see : examples