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
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.
The text was updated successfully, but these errors were encountered:
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.
The text was updated successfully, but these errors were encountered: