jam1garner / binrw

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

Allow self in non-unit struct and enum top-level assert #219

Closed octylFractal closed 1 year ago

octylFractal commented 1 year ago

Also allows top-level map to use self instead of this.

Complete with documentation!

csnover commented 1 year ago

This was rebased, and is merged now. I added a couple of additional commits:

  1. Tried clarifying the docs and added an example using top-level map
  2. Removed the this-compatibility and sanitised the variable
  3. Fixed auto-derived assertion failure messages from leaking the internal transformation from self to something else, and added a test for that
  4. Fixed nightly lints, which no longer allow message-less panics.