binrw
binrw copied to clipboard
A Rust crate for helping parse and rebuild binary data using ✨macro magic✨.
Normal enum: ```rust enum MagicTest { Zero, #[brw(magic = 1u8)] One, #[brw(magic = 2u8)] Two(()), } ``` Unit enum: ```rust enum MagicTest { Zero, #[brw(magic = 1u8)] One, #[brw(magic =...
It would be great if it would be possible to skip writing of individual fields conditionally, similar to what `br(if(...))` does for reading. API could look like this: ```rust #[binrw]...
Apparently it's not possible to to pass a arguments to a `Vec` of `BinRead` objects. Here's an example: ```rust use binrw::{binrw, BinRead}; #[binrw] #[derive(Debug)] #[brw(little)] struct Data { version: u16,...
https://tokio.rs/blog/2021-07-announcing-axum#extractors > Requests can be parsed declaratively using "extractors". An extractor is a type that implements FromRequest. Extractors can be used as arguments to handlers and will run if the...
There doesn't seem to be any good reason for writer to be sized, since it's just a mutable reference. Without `?Sized`, it's impossible to use trait objects with BinWrite.
While trying out binrw, I implemented a parser using the ``binrw`` attribute while I should have been using the ``binread`` one instead. Due to missing a binwrite impl for my...
Sometimes it's necessary to have access the serialized bytes instead of the deserialized data, e.g. for calculating a checksum over parts of the serialized data: ```rust #[binread] #[brw(big)] struct Foo...
General idea is providing a module containing both a custom parser and a custom writer function. This would also make it easier to make binrw compatibility crates by allowing you...
Todo: - [x] Document end-user ability to use reference types - [x] Document limitations regarding manual lifetime specification (eg to use `'_`) - [x] Better document how manual `BinRead` implementations...