1
0
mirror of https://github.com/danog/strum.git synced 2024-11-26 20:14:40 +01:00
Commit Graph

194 Commits

Author SHA1 Message Date
Peter Glotfelty
d32af44f2e
Fix "Display" for non string Defaults (#308)
* Fix "Display" for non string Defaults

* This version actually works :)

---------

Co-authored-by: Peter Glotfelty <peter@glotfelty.us>
2023-10-28 18:55:52 -07:00
Peter Glotfelty
597f8e941f publish 0.25.3 2023-10-14 12:21:13 -07:00
horacimacias
42c16664a8
Fix EnumIter for enums named Option (#300)
Co-authored-by: Horaci Macias <hmacias@avaya.com>
2023-10-15 15:08:35 -07:00
Wyatt Herkamp
0199235bb0
Fix Generics Issue with enum_is (#305) 2023-10-15 15:07:46 -07:00
Michael Schubart
3664c5e8ca
Remove unused vectors (#304) 2023-10-15 15:06:49 -07:00
Wyatt Herkamp
af9b15b617
Add doc comment to EnumIs result (#301) 2023-10-15 15:05:55 -07:00
Peter Glotfelty
db553e3dcf
Merge pull request #285 from MendyBerger:try-as
Added EnumTryAs
2023-08-26 14:49:58 -07:00
Peter Glotfelty
3341c2f394 updated changelog to 0.25.2 2023-08-06 16:55:18 -07:00
hasezoey
2782412396
Enable doc-test for "strum_discriminants(vis(pub))" (#289) 2023-08-06 16:48:02 -07:00
Mendy Berger
4014b3e2d1 Requested changes in review 2023-07-31 16:44:38 -04:00
bouzuya
fcb9841a74
Add test and comment if camel_case is specified (#250)
Co-authored-by: Peter Glotfelty <glotfelty.2@osu.edu>
2023-07-29 15:00:13 -07:00
kraktus
fd519ec47f
Fix EnumIter macro code generation (#287)
* 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>
2023-07-29 14:58:18 -07:00
MendyBerger
e0f81e9caa Added EnumTryAs 2023-07-16 22:59:38 -04:00
Peter Glotfelty
96c63e9f5c Fix a typo in Changelog wrt new version 2023-07-03 14:42:27 -07:00
Peter Glotfelty
69e3449c0e Publish new version with fix #276 2023-07-03 13:49:32 -07:00
Samuel Moelius
93ea44dd12
Handle rustoc comments in #[derive(FromRepr)] (#276) 2023-07-03 13:45:32 -07:00
Peter Glotfelty
0a0def76bd
update ci version (#280)
Co-authored-by: Peter Glotfelty <peter@glotfelty.us>
2023-07-01 13:17:30 -07:00
Peter Glotfelty
2bcf86d0ca Update README and CHANGELOG for new version 2023-06-17 17:28:04 -07:00
Mendy Berger
85e2c1692b
Added enum_is (#257)
* Added enum_is

* feat(is): Use a simple match and cover all cases

* Removed dependency convert_case

* Added disabled support for enum_is
2023-06-17 17:58:53 -07:00
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
CosmicHorror
2b71e10120
Update syn to v2 (#261) 2023-06-17 17:57:26 -07:00
Matt Schulte
67f0d1947d
Fix EnumCount with disabled variants (#268)
Do not include disabled variants in the count with EnumCount. Fixes #267
2023-06-17 17:50:15 -07:00
Jan Philipp Bittner
025b1b5687
add missing word (#263) 2023-05-06 15:24:04 -07:00
Rory Snively
30c5c16515
fix deprecation warning in additional_attributes example (#264) 2023-05-06 14:55:43 -07:00
Martin Kauppinen
635ab9511b
Add Train-Case case style (#256) 2023-03-12 14:48:07 -07:00
Kesavan Yogeswaran
405832679f
Fix doc comment for strum::EnumIter macro (#253)
The `EnumIter` macro's doc comment has a typo around the implemented
trait. The implemented trait is `strum::IntoEnumIterator`.
2023-02-26 11:08:58 -08:00
Alex
7efb86efbe
Change kebab_case to kebab-case in example (#248) 2023-01-02 16:00:42 -08:00
Peter Glotfelty
e772e203da
implement Debug for EnumIter (#240)
Co-authored-by: Peter Glotfelty <peter@glotfelty.us>
2022-10-15 12:00:20 -07:00
Mike Leany
dd0c2fa785
Fix doc comment for EnumIter (#242)
Comment now says that it iterates over variants of the enum rather than
variants of `Self`, which would be the iterator.
2022-10-15 11:59:55 -07:00
Alissa Tung
93d0886377
chore: fix typo (#239)
* chore: fix typo

* chore: fix typo
2022-09-25 12:10:49 -07:00
Tim Siegel
54771c0870
strum_macros::FromRepr: fix typo in documentation (#236) 2022-09-19 10:31:34 -07:00
Peter Glotfelty
7e8a9304bf Update changelog 2022-08-07 16:35:38 -07:00
Peter Glotfelty
d8278db866
add allows to prevent lint errors (#231)
Co-authored-by: Peter Glotfelty <peter@glotfelty.us>
2022-08-07 16:32:28 -07:00
Peter Glotfelty
0ba53fff6c Publishing a new version without #217 to enable phf 2022-06-24 17:53:45 -07:00
Peter Glotfelty
b5ba7cc12c
Revert "Add TryFrom to FromRepr (#217)" (#228)
This reverts commit ac757fa970.
2022-06-24 17:47:32 -07:00
Peter Glotfelty
5685f9b96d updated CHANGELOG with yanked package 2022-06-16 07:44:41 -07:00
Peter Glotfelty
b25ea1b9a0 Get ready to publish 0.24.1 2022-06-12 13:33:21 -07:00
Peter Glotfelty
a952fc0028
Peternator7/update phf logic (#224)
* 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>
2022-05-16 21:33:33 -07:00
Peter Glotfelty
c560f3e4c0
Disable the test_phf feature on 1.32 (#222)
Co-authored-by: Peter Glotfelty <peter@glotfelty.us>
2022-05-01 08:54:09 -07:00
Peter Glotfelty
b1befeb594 See if this gets the build fixed 2022-04-30 15:26:54 -07:00
Ten0
832dd862c7
Add support for PHF in EnumString (#220)
* 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
2022-04-30 15:23:28 -07:00
ac757fa970
Add TryFrom to FromRepr (#217)
* Add TryFrom to FromRepr

* Fix building on rust < 1.34
2022-04-30 11:24:17 -07:00
Peter Glotfelty
054df849e1 Fix unit tests 2022-04-16 12:28:10 -07:00
Spenser Black
9465cd5dbb
Use full path for None in EnumIter (#214) 2022-03-14 09:22:19 -07:00
Peter Glotfelty
94460f006c Revert a small change from get_docs 2022-02-21 14:20:01 -08:00
Peter Glotfelty
96228c76cb Add updates for 0.24 2022-02-21 14:07:48 -08:00
Oren Ben-Kiki
e558e913f4
Add get_documentation() to EnumMessage. (#206)
* 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>
2022-02-21 13:37:25 -08:00
Marcel Hellwig
672ac26005
Clippy lints and some minor nitpicks (#212)
* 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
2022-02-18 16:04:31 -08:00
matt rice
c676655d11
use core instead of std in a couple places. (#209) 2022-02-05 15:29:26 -08:00
daxpedda
260322fb7e
Add allow(clippy::use_self) to remove warnings from FromRepr (#211) 2022-02-05 15:28:57 -08:00