Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(model): derive Default for ActionRow #1772

Closed
wants to merge 4 commits into from

Conversation

itohatweb
Copy link
Member

Since action rows only contain a components vector deriving default should be no problem.

Since action rows only contain a components vector deriving default
should be no problem.
@github-actions github-actions bot added c-model Affects the model crate t-feature Addition of a new feature labels Jun 4, 2022
Copy link
Member

@vilgotf vilgotf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unlikely for Discord to break this type's API (where default is impossible)

@zeylahellyer
Copy link
Member

What's the motivation?

@itohatweb
Copy link
Member Author

Mostly because of #1752
Thinking of whether doing

let components = ComponentsBuilder()::new()
    .action_row(ActionRow { components: Vec::new() })
    .build();

or just

let components = ComponentsBuilder()::new()
    .action_row(Default::default())
    .build();

Also as vilgotf has said it's unlikely that ActionRow will get any change which would cause us removing Default.

@zeylahellyer
Copy link
Member

Why would one want an empty action row?

@itohatweb
Copy link
Member Author

I saw quite a few use cases where people start with an empty action row and populated it later.

@zeylahellyer
Copy link
Member

I'm not personally convinced from the examples provided that it's worth making this commitment. It feels like if one has a ComponentsBuilder then an action_row method should take a built action row, not an action row to be later modified; in other words, there would rather be an ActionRowBuilder that builds an action row and is then passed to ComponentsBuilder, removing the state of the empty action row in the context of builders.

@7596ff
Copy link
Contributor

7596ff commented Jun 7, 2022

I'm also not in favor of this change. Going to give this a close.

@7596ff 7596ff closed this Jun 7, 2022
@7596ff 7596ff deleted the itohatweb/feat/action-row-default branch June 7, 2022 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c-model Affects the model crate t-feature Addition of a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants