One thing I've noticed when writing method generators is that they have a lot of repetitive boilerplate. For example, in getters.rs:impl_enum_as_getters, there are four variables created, twice in that same method, that do very similar things:
variant_names
function_names
function_name_strs
variant_types
The recreation and repetition is unavoidable, because of limitations in the quote crate. There are minor differences between each creation, but syntactically, has the same structure.
And this is just one example. It's like this in every generator method as far as I'm aware. Hypothetically, we could keep doing it this way, with lots of copy/paste-driven development. But I feel like there's a better way.
Anyway, if you're looking to get your hands dirty with some Rust macros, feel free to give this a shot and let me know what you find.
One thing I've noticed when writing method generators is that they have a lot of repetitive boilerplate. For example, in getters.rs:impl_enum_as_getters, there are four variables created, twice in that same method, that do very similar things:
variant_namesfunction_namesfunction_name_strsvariant_typesThe recreation and repetition is unavoidable, because of limitations in the
quotecrate. There are minor differences between each creation, but syntactically, has the same structure.And this is just one example. It's like this in every generator method as far as I'm aware. Hypothetically, we could keep doing it this way, with lots of copy/paste-driven development. But I feel like there's a better way.
Anyway, if you're looking to get your hands dirty with some Rust macros, feel free to give this a shot and let me know what you find.