Peternator7 / strum

A small rust library for adding custom derives to enums
https://crates.io/crates/strum
MIT License
1.8k stars 152 forks source link

strum::Display doesn't work with non-unit non-string variants #306

Closed Keshi closed 1 year ago

Keshi commented 1 year ago

strum::Display and #[strum(default)] doesn't work with non-unit non-string variants. It should probably try to convert the enclosed tuple into a string?

#[derive(strum::Display)]
enum Color {
    Red,
    Blue,
    Green,
}
#[derive(strum::Display)]   <---- this fails: Mismatched types.
enum TestEnum {
    #[strum(default)]
    Color(Color),
}