A declarative converter for Rust type to and from binary.
It provides basic implementations for most standard Rust types and also provides a derive macro to automatically implement the trait on your own types !
For bit level control or more advanced features, take a look at deku.
```Rust use ::simple_parse::{SpRead, SpWrite};
pub struct SomeStruct {
pub some_field: u8,
#[sp(endian="big")]
pub items: Vec
let mut cursor: &[u8] = &[ 1, // some_field 2,0,0,0,0,0,0,0, // items.len() 0xDE,0xAD,0xBE,0xEF, // items[0] 0xBA,0xDC,0x0F,0xFE // items[1] ];
// Decode bytes into a struct let mut mystruct = SomeStruct::fromreader(&mut cursor)?;
/// Modify the struct my_struct.items.push(0xFFFFFFFF);
/// Encode modified struct into bytes
let mut dstbuf: Vec
For complete examples see : examples
| Feature | Description |
|:----:|:----|
| No-Copy parsing | simpleparse is able to generate references into byte slices (see struct.rs) |
| count | Annotating a dynamically sized field with count
allows it's number of items to live somewhere else in the struct. The default is to simply prepend the number of items as a u64|
| endian | Annotating structs/fields with endian
gives control over how numbers will be parsed |
|Custom read/write | Custom parsers can be writen for individual fields when simpleparse doesnt have the adequate default implementation|