jam1garner / binrw

A Rust crate for helping parse and rebuild binary data using ✨macro magic✨.
https://binrw.rs
MIT License
545 stars 35 forks source link

add doc example for implementing BinRead #211

Closed ScanMountGoat closed 6 months ago

ScanMountGoat commented 1 year ago

Adds a slightly non trivial example for how to implement BinRead. I found that implementing BinRead for a generic type with the recent args changes was straightforward but not very obvious without examples.

csnover commented 11 months ago

Hi, sorry about the delay. Wondering if it would be possible to do this example not using the FilePtrArgs type? It might be a silly thing to request since these are technically part of the public API but at the moment my gut says it isn’t a good idea to put examples in the docs that use these associated types that are only intended to be used with their parent class.

ScanMountGoat commented 11 months ago

I can change it to use a custom args type like CustomPtr32Args with the same fields.

ScanMountGoat commented 10 months ago

Do the latest changes look ok? @csnover

ScanMountGoat commented 8 months ago

Any updates on this? @csnover

ScanMountGoat commented 7 months ago

Does this look ok? @csnover