Skip to content

Field renaming #10

Description

@FallBackITA27

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions