Skip to content

Ability to define 'catch-all' enum variant #14

Description

@JamesHinshelwood

It would be beneficial to me to be able to define an extra variant of my enum which is used in the FromStr impl when none of the other variants match.

For example,

#[derive(FromStr)]
enum Fruit {
  #[display("appl")]
  Apple,
  #[display("orng")]
  Orange,
  #[else] // Not sure about naming of this attribute?
  Other(String),
}

If you aren't opposed to the idea, I would like to try adding this feature. Also, if anyone has any good naming ideas that would be appreciated.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions