* Add test to ensure macro call `::core`-related functions
Avoiding local core modules to break the macro-generated code.
Currently failing due to issue with `EnumIter` macros.
* Fix macro of `EnumIter`
close https://github.com/Peternator7/strum/issues/284
---------
Co-authored-by: kraktus <kraktus@users.noreply.github.com>
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)
```
* Support phf crate for faster match on large enums
* comment
* add changelog entry
* add tests, embed phf, and improve lowercase support
* fix doc change
* Refactor & support case insensitive with case sensitive phf match
* more tests, some fixes of new implementation and prep for feature
* Modify the initial implementation.
Co-authored-by: Thomas BESSOU <thomas.bessou@hotmail.fr>
Co-authored-by: Peter Glotfelty <peter@glotfelty.us>
* Support phf crate for faster match on large enums
* comment
* add changelog entry
* add tests, embed phf, and improve lowercase support
* fix doc change
* Refactor & support case insensitive with case sensitive phf match
* more tests, some fixes of new implementation and prep for feature
* Add get_documentation() to EnumMessage.
* Address 1st review comments.
* Remove usage of strip_prefix to support older Rust versions.
Co-authored-by: Peter Glotfelty <glotfelty.2@osu.edu>
* add clippy.toml with an msrv
* fix clippy lints
* replace inefficient algorithm
* replace ::std with ::core in more places and comments
* fix some test warnings
* fix clippy lints in tests
The addition of TryFrom<&str> for EnumString breaks for enums that have
a variant called "Error". Rewrite as <Self as Trait> where associated
types are used as the return type for trait functions.
Example:
```rust
pub enum Test {
Error,
}
```
error: ambiguous associated item
--> src/lib.rs:3:10
|
3 | #[derive(EnumString)]
| ^^^^^^^^^^
|
= note: `#[deny(ambiguous_associated_items)]` on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #57644 <https://github.com/rust-lang/rust/issues/57644>