bin_read! macro for declarative binary parsing (ReadBinary generation)
#119
Closed
zeonzip
started this conversation in
Ideas and Feature Requests
Replies: 1 comment 1 reply
-
|
Thanks for the suggestion! We are always interested in exploring ideas for binary format parsing, which we are experimenting with here:
Most of these are focused on compilers and DSLs, but it is useful to consider what Rust macros can do! |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hey! I saw the way
allsortscurrently writes ReadBinary implementations for tables are quite repetitive, very manual and has alot of boilerplate so I wanted to suggest a procedural macro which could help in generating less error prone, more readable implementations with abin_read!macro.Proposed syntax (example with SvgTable):
The bin_read! macro would generate a ReadBinary implementation for the type and the HostType accordingly and would result in a roughly the same implementation:
Totally get if this isn't something that fits the project or is overkill, wanted to share it incase it was found interesting or sparked ideas!
Beta Was this translation helpful? Give feedback.
All reactions