An idea as for renaming fields on duplicates
#[either_field::make_template(
DerivedStruct:
[
field_name as new_field_name: i32
],
)]
This is useful in cases you have a field such as player_id that can also be the player data, being able to rename it to player as to clear up confusion.
Issue
This is currently not possible with the implementation using generics type DerivedStruct = OriginalStruct;.
While this could, arguably, be ditched, it would require rewriting the macro's internals from scratch and the behavior would break. Subtypes from structs derive the same implementations as the original types, while generating completely new structs wouldn't.
An idea as for renaming fields on duplicates
This is useful in cases you have a field such as
player_idthat can also be the player data, being able to rename it toplayeras to clear up confusion.Issue
This is currently not possible with the implementation using generics
type DerivedStruct = OriginalStruct;.While this could, arguably, be ditched, it would require rewriting the macro's internals from scratch and the behavior would break. Subtypes from structs derive the same implementations as the original types, while generating completely new structs wouldn't.