You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've created two (procedural) macros to write system data structs more concisely. I'm opening this "feature request" to 1. share them, 2. offer them as contributions or at least inspirations. The implementations currently live in https://github.com/abesto/rktrl/blob/master/rktrl_macros/src/lib.rs.
Motivation
systemdata
Minimize boilerplate
Standardize naming of fields, but allow overriding
Prevent mistakes where the order of components when saving and loading is mismatched
The implementation solves the 16 tuple size limit by chunking components into 16-sized tuples, so that actual saving would iterate over 16-tuples and save those one by one.
Error messages are sometimes hard to understand when macro usage is messed up
Builds on top of current specs_derive instead of integrating with it deeply
Unresolved questions
I'm using this in my hobby project happily, but have zero experience with production-ready macros. That's where I expect most of the problems (unknown to me currently) to creep in. I guess there's also bikeshedding to be done around the syntax.
I'd be happy to "formally" contribute these macros as a PR if it makes sense, and to put in some work iterating on them based on feedback.
The text was updated successfully, but these errors were encountered:
Description
I've created two (procedural) macros to write system data structs more concisely. I'm opening this "feature request" to 1. share them, 2. offer them as contributions or at least inspirations. The implementations currently live in https://github.com/abesto/rktrl/blob/master/rktrl_macros/src/lib.rs.
Motivation
systemdata
Example usage
Generates roughly:
saveload_systemdata
The implementation solves the 16 tuple size limit by chunking components into 16-sized tuples, so that actual saving would iterate over 16-tuples and save those one by one.
Example:
Generates roughly:
Drawbacks
specs
specs_derive
instead of integrating with it deeplyUnresolved questions
I'm using this in my hobby project happily, but have zero experience with production-ready macros. That's where I expect most of the problems (unknown to me currently) to creep in. I guess there's also bikeshedding to be done around the syntax.
I'd be happy to "formally" contribute these macros as a PR if it makes sense, and to put in some work iterating on them based on feedback.
The text was updated successfully, but these errors were encountered: