1
0
mirror of https://github.com/danog/strum.git synced 2024-12-04 10:28:13 +01:00
strum/strum_tests/tests
Josh McKinney e6a9bf08c4
fix!: use the tuple value for to_string on default (#270)
The default attribute on a tuple like variant now causes the to_string
and display format to use the value of the tuple rather than the name
of the variant.

E.g. Color::Green("lime").to_string() will equal "lime" not "Green"

Fixes: how to round trip Display and EnumString with default="true" #86

BREAKING CHANGE
This changes how Display and ToString cause the following to renders:
```rust
#[strum(default)]
Green(String)
```
To maintain the previous behavior (use the variant name):
```rust
#[strum(default, to_string("Green"))]
Green(String)
```
2023-06-17 17:58:12 -07:00
..
as_ref_no_strum.rs Update strum to Rust edition 2018 (#110) 2020-09-17 11:21:21 -07:00
as_ref_str.rs Clippy lints and some minor nitpicks (#212) 2022-02-18 16:04:31 -08:00
display.rs fix!: use the tuple value for to_string on default (#270) 2023-06-17 17:58:12 -07:00
enum_count.rs Fix EnumCount with disabled variants (#268) 2023-06-17 17:50:15 -07:00
enum_discriminants.rs Clippy lints and some minor nitpicks (#212) 2022-02-18 16:04:31 -08:00
enum_iter.rs Re-export macros (#170) 2021-07-16 20:40:19 -07:00
enum_message.rs Add get_documentation() to EnumMessage. (#206) 2022-02-21 13:37:25 -08:00
enum_props.rs Re-export macros (#170) 2021-07-16 20:40:19 -07:00
enum_variant_names.rs Clippy lints and some minor nitpicks (#212) 2022-02-18 16:04:31 -08:00
from_repr.rs Revert "Add TryFrom to FromRepr (#217)" (#228) 2022-06-24 17:47:32 -07:00
from_str.rs Add tests for nostd environment (#196) 2021-11-20 11:30:11 -08:00
phf.rs Add support for PHF in EnumString (#220) 2022-04-30 15:23:28 -07:00
serialize_all.rs Clippy lints and some minor nitpicks (#212) 2022-02-18 16:04:31 -08:00
to_string.rs fix!: use the tuple value for to_string on default (#270) 2023-06-17 17:58:12 -07:00