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

172 Commits

Author SHA1 Message Date
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
Alex Gaynor
fb88d04dcf
Update to heck 0.4 (#201) 2022-01-15 12:40:14 -08:00
Peter Glotfelty
b855edb463
Peternator7/enum iter doc comment (#204) 2022-01-14 06:54:03 -08:00
Peter Glotfelty
837c785a88
Pin clap version (#205)
Co-authored-by: Peter Glotfelty <peter@glotfelty.us>
2022-01-09 09:37:17 -08:00
Peter Glotfelty
4f6a556b9a Merge branch 'master' of https://github.com/Peternator7/strum 2022-01-08 12:11:33 -08:00
LJ
ced17d4c58
Add doc comment to FromRepr macro (#202)
This will help people who have missing_docs denied.
2022-01-08 12:08:45 -08:00
Peter Glotfelty
5d733fd1f3 Update package version to include patches 2021-11-20 11:34:26 -08:00
Peter Glotfelty
0c80602333
Add tests for nostd environment (#196)
Co-authored-by: Peter Glotfelty <peter@glotfelty.us>
2021-11-20 11:30:11 -08:00
Peter Glotfelty
2ba6b0a9c3
Run rustfmt over the whole tree (#195)
Co-authored-by: Peter Glotfelty <peter@glotfelty.us>
2021-11-19 18:31:08 -08:00
Tyler Hall
1e3acb64a7
Disambiguate associated items in trait impls (#193)
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>
2021-11-19 12:12:59 -08:00
Danny Milosavljevic
5c0ee93860
Use core::* instead of std::* in order to make it work in a no_std environment. (#192)
Co-authored-by: Danny Milosavljevic <daym@oxidecomputer.com>
2021-11-18 11:11:02 -08:00
Peter Glotfelty
5272fcea91 Tweak docs to format correctly and update crates to the newest version 2021-11-16 22:24:17 -08:00
Peter Glotfelty
c8cd49f4e3 Use rustversion instead of version_check in strum_tests 2021-11-16 21:56:51 -08:00
Andrew Burkett
aeaa19ad86
EnumIndex implementation (#185)
* Add EnumConstIndex

* Get working with discriminants

* Remove unused/(unneeded?) features

* Rename to EnumIndex and index(..). Make const_index conditional

* Get repr(..) working

* Fix issue to support rust 1.32

* Switch from VARIANT# to {ENUM}_{VARIANT} for variant constant names

* Expose constants as part of implementation

* Add discriminant error messages. Cargo fmt my code

* Add rustversion to make compilation conditional on 1.46

* Handle expr discriminants

* Fix generics handling

* Make constants always available. No need to only expose them when const_index is defined

* Change to FromDiscriminant. Only output a single function

* Don't make constants accessible

* Make rustversion a dev dependency in strum-tests due to upstream change

* Cleanup doc tests for const

* Rename to FromRepr/from_repr
2021-11-06 09:30:09 -07:00
Danny Milosavljevic
1a703a4103
Use core::result instead of std::result in order to make it work in a no_std environment. (#189)
Co-authored-by: Danny Milosavljevic <daym@oxidecomputer.com>
2021-10-26 12:17:54 -07:00
Dominik Spicher
7b68e4dc44
Add TryFrom<&str> to EnumString (#186)
The implementation simply delegates to `std::str::FromStr`.

To maintain compatibility with Rust 1.32, a new dependency
is introduced which allows us to emit the `TryFrom<&str>`
implementation only for Rust 1.34 and above when
`std::convert::TryFrom` was stabilized.
2021-10-26 12:16:57 -07:00
Peter Glotfelty
f50fc72165
Update README.md
Fix a typo in the readme
2021-10-14 09:12:09 -07:00
Peter Glotfelty
08583fcb11
Make changes necessary for version 0.22 (#181)
* Make changes necessary for version 0.22

* Update changelog

Co-authored-by: Peter Glotfelty <peter@glotfelty.us>
2021-10-10 20:47:24 -07:00
Peter Glotfelty
1ec35285a0
Update documentation to include listing all the supported case styles. (#182)
Co-authored-by: Peter Glotfelty <peter@glotfelty.us>
2021-10-10 12:45:19 -07:00
Peter Glotfelty
07f9fe30e2
ToString is deprecated in favor of display. (#180)
* ToString is deprecated in favor of display.

* Remove doc(hidden)

* Remove references to `ToString` macro

Co-authored-by: Peter Glotfelty <peter@glotfelty.us>
2021-10-09 15:03:33 -07:00
Jonathan Chan Kwan Yin
6119f107e2
Fixed incorrectly commented deprecated attribute (#178)
* Fixed incorrectly commented `deprecated` attribute

* Also deprecate the `AsStaticRef` macro.

* Changed deprecation version to 0.22.0
2021-10-07 21:43:49 -07:00
Peter Glotfelty
75519edcff pin bitflags version in tests project to fix builds 2021-10-02 08:30:03 -07:00
Cor Peters
db5071874b
Features/no std (#171)
* Added std feature to allow for no_std usage

* added no_std attr

Co-authored-by: Luctius <luctius@gmail.com>
2021-08-03 21:19:21 -07:00