Replies: 2 comments
-
Hey @TomzBench, this is actually something I've been thinking about supporting for quite some time. I'm not as well-versed with proc macro implementations so feel free to give it a whirl and open a PR. As a starting point, you may want to look through the basic visitor trait in https://github.com/anweiss/cddl/blob/main/src/visitor.rs. You could probably implement the trait with a proc macro. |
Beta Was this translation helpful? Give feedback.
0 replies
-
This sounds more like something that would fit well within https://github.com/dcSpark/cddl-codegen |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
If I have some CDDL, is it possible to automatically instantiate a struct with fields using procedure macros?
IE:
The struct is "empty" but after the macro runs, the fields should be populated with rust representation of the CDDL description. Then you can use this in combination with Serde Serialize/Deserialize macros and get encoder/decoder for your struct.
IE:
To deal with nesting structs, the proc macro attribute could be at the module level, and just generate all the structs from the cddl. If one is familiar with proc macros, but not familiar with this crate, do you have any recommendations on how to go about implementing this? See any oversights?
Beta Was this translation helpful? Give feedback.
All reactions