-
-
Notifications
You must be signed in to change notification settings - Fork 148
feat(model): add enum variant from/tryfrom conversion #2502
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
base: main
Are you sure you want to change the base?
Conversation
| User(Id<UserMarker>), | ||
| } | ||
|
|
||
| impl CommandOptionValue { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SubCommand and SubCommandGroup have the same inner type, so no conversion implementations are provided
| /// | ||
| /// [`member`]: Self::member | ||
| /// [`user`]: Self::user | ||
| pub fn into_author(self) -> Option<User> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Matching owned variant to author()
|
|
||
| #[derive(Debug, Deserialize)] | ||
| #[serde(field_identifier, rename_all = "snake_case")] | ||
| enum Field { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did not bother sorting its usage
| command::{ | ||
| Command, CommandOption, CommandOptionChoice, CommandOptionChoiceValue, | ||
| CommandOptionType, CommandOptionValue, CommandType, | ||
| CommandOptionType, CommandType, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Applied the provided From implementations
These convenience implementations bring a better developer experience. This PR also features some cleanup with struct field/enum variant sorting