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

110 Commits

Author SHA1 Message Date
Peter Glotfelty
1f1587f917 Update msrv because of heck. 2021-02-20 14:56:05 -08:00
Amrit Rathie
fb2f1b25ae
docs: Minor version in README docs.rs links (#148)
Use semver minor version rather than patch version in README.

Since doc.rs can resolve crate versions just like `cargo`, this will make the links point to the latest
version of the documentation.
2021-02-13 17:39:41 -08:00
Rudi Benkovič
684f119dab
Replaced ::std with ::core where applicable. (#145)
This makes these macros usable with `no_std` projects.
2021-02-06 08:28:50 -08:00
Peter Glotfelty 🚀
96ee0a9a30 Updated changelog for strum 0.20 2020-11-21 20:13:44 +00:00
Mark LeMoine
ddb9c2682e
Adding visibility option vis(...) to #[strum_discriminants] (#137) (#138)
* Adding vis to EnumDiscriminants (#137)

* Improved doctest example names (#137)

* Fixing incorrect occurrence_error attr string

* Using r#pub on doctest

* Adding tests for discriminant visibility, and rustc-cfg for bare "pub"

* Doing local import with "self::"

* Back to having tests pass on latest stable

* Moved sample doctest with vis example to separate nocompile block
2020-11-15 20:13:50 -08:00
Jonas Platte
90047fee86
Replace macro panics with syn::Error (#135) 2020-10-19 09:56:49 -07:00
Jonas Platte
25eaa5a12c
More attribute refactoring (#134)
* Remove unused method NestedMetaHelpers::expect_lit

* Use references match instead of ref patterns

* Use custom meta types instead of syn::Meta

This should improve both readability of the code and the quality of
error messages.

* Replace TryFrom<&str> with FromStr

* Restore Rust 1.31.1 compatibility

* Re-run `cargo fmt`
2020-10-15 09:27:38 -07:00
Jonas Platte
4ad39923d0
Refactor (#133)
* Remove unnecessary main in doctest

* Use syn::parse_macro_input!

* Add spans to attribute parse errors

* Add spans to more attribute errors

* Fix indentation

* Consistently import syn AST types
2020-10-07 22:18:30 -07:00
Peter Glotfelty 🚀
441316121b Updated changelog and readme with new version as well as tweaked docs slightly. 2020-10-07 05:52:12 +00:00
Michael Kefeder
89b9c14731
Wiki to doc tests (#121)
* example usage as doctests added to the strum_macros crate

* removed links to to wiki example code and documentation of the macros

* added attribute documentation as a module in strum and linked to it
2020-10-06 10:17:06 -07:00
Jonas Platte
7e64a470b1
Raise an error un malformed strum attributes (#119) 2020-09-29 10:01:29 -07:00
Peter Glotfelty
1d2778842b
Re-Enable Travis via travis.com (#112)
* Enable travis

* add build.r to re-enable try_from
2020-09-17 11:21:41 -07:00
Jonas Platte
b517f232aa
Update strum to Rust edition 2018 (#110)
* Set all crates to edition 2018

* Remove redundant imports

* Remove extern crate declarations for cargo dependencies
2020-09-17 11:21:21 -07:00
Peter Glotfelty
c9e1a0e16d
Merge pull request #111 from Peternator7/peternator7/fix-msrv-issues
Fix issues that were preventing the code from compiling on 1.31.1
2020-09-17 06:23:12 -07:00
Peter Glotfelty 🚀
5b89fb7bfc fix indentation 2020-09-17 05:09:18 +00:00
Peter Glotfelty 🚀
4824b1b3ab added newline 2020-09-17 05:02:08 +00:00
Peter Glotfelty 🚀
38fdea4ad8 Fix issues that were preventing the code from compiling on 1.31.1 2020-09-17 05:01:05 +00:00
Peter Glotfelty
3299622842
Fixes a panic caused by unwrapping an option (#105)
* Fixes a panic caused by unwrapping an option

* updating to 0.19.2 to fix regression 104
2020-08-05 21:36:47 -07:00
Peter Glotfelty 🚀
06bbb62624 ran cargo fmt over the whole tree 2020-08-06 00:09:12 +00:00
Sean Stangl
a11862cebb
Update README.md with most recent strum version (#102)
The README.md hardcoded the version `0.18.0` in the `Cargo.toml` description. This changes it to `0.19` without the patch version, ensuring that it will be accurate until the next minor release.
2020-08-03 14:05:09 -07:00
Peter Glotfelty 🚀
9508a31f4b Didn't actually change enum variant names in the 0.19 like I meant to. 2020-08-02 00:07:38 +00:00
Peter Glotfelty
7e5b5e43e8
Peternator7/0.19 (#101)
* Changelog for 0.19

* Updated version in Cargo.toml
2020-08-01 16:54:43 -07:00
Peter Glotfelty
c5fc096ece
Pulled some of the core logic out of plugins (#100)
* Major refactor of code.

* More minor refactorings

* renamed variables

* add repository link
2020-07-29 09:36:48 -07:00
Peter Glotfelty
ee8a0d2522
Merge pull request #99 from Peternator7/peternator7/enum_count
Replaced const fn count with associated constant.
2020-07-26 11:46:27 -07:00
Peter Glotfelty 🚀
ec3297242c Replaced const fn count with associated constant. 2020-07-26 04:41:15 +00:00
Peter Glotfelty
95645cac52
Fix Display macro to handle fill/align (#95) 2020-06-12 13:54:51 -07:00
Casey Rodarmor
a20ee16d6b
Add repository link in strum crate Cargo.toml (#90)
* Add repository link in strum crate Cargo.toml

Having a repository link provides a helpful backlink to the crate in docs.rs

* Remove extra space character
2020-05-08 12:58:46 -07:00
root
fd96b62516 updated changelog 2020-03-02 00:01:53 +00:00
root
da37cc3141 Made a fix for #80 2020-03-01 23:55:53 +00:00
Peter Glotfelty
de17e1c7a2
nth_back wasn't stablilized until 1.37 (#85) 2020-02-10 15:58:11 -08:00
t-mw
043b60f6d8
Apply serialize_all casing to get_serializations (#84)
* Apply serialize_all casing to get_serializations

* Update changelog

* Fix grammar
2020-02-10 15:55:18 -08:00
Azriel Hoh
2b83eceba6
Bugfix/73/whitelist variant attributes to copy (#82)
* Whitelist attributes to copy to `EnumDiscriminants`' variants.

* Updated `CHANGELOG.md`.
2020-02-08 10:54:44 -08:00
Peter Glotfelty 🚀
cb38036b60 reverting one change and adding another 2020-01-11 19:13:08 +00:00
Peter Glotfelty 🚀
aa1958f159 editing post create command 2020-01-11 19:09:11 +00:00
Peter Glotfelty 🚀
2237b65d47 Adding a post create command 2020-01-11 19:04:25 +00:00
Peter Glotfelty 🚀
700de6bfb7 trying to get vsonline working again 2020-01-11 18:40:29 +00:00
Peter Glotfelty 🚀
7de6f84546 trying to get vsonline working 2020-01-11 18:32:52 +00:00
Peter Glotfelty 🚀
d25af73564 added vsonline config 2020-01-11 18:20:44 +00:00
Peter Glotfelty
98b41a5354 Fixed an issue with EnumIter overflowing 2019-12-20 02:28:30 +00:00
Peter Glotfelty
6ba428fd1a Updating readme to reflect new version 2019-12-19 23:18:17 +00:00
Nevsor
8db6a31332 Implemented DoubleEndedIterator for EnumIter. (#60)
* Implemented DoubleEndedIterator for EnumIter.

* Fixed overlapping behaviour of next and next_back.

* Changed names of tests I accidentally swapped.

* Fixed size_hint() for EnumIter.

* Implemented more efficient version of nth() for EnumIter.

* Added another test of  `next` and `next_back`, where the last call is to `next`.
2019-12-19 14:44:30 -08:00
Waffle Lapkin
eea32dbf7f Const enum variants names (#75)
* Add implementing const `VARIANTS` by `EnumVariantsNames`, deprecate old `::variants`

* Move `const VARIANTS` to `VariantNames` trait

* Remove `VariantNames::variants` function
2019-12-12 13:39:10 -08:00
Cedric Hutchings
a94c8b0ce1 Replace 'variantes' with 'variants' in README.MD (#79) 2019-12-12 10:54:32 -08:00
Spanfile
bc8fa93ee8 Move EnumVariantsNames into a trait which the macro implements (#74)
* Add VariantNames trait with the variants() function which the EnumVariantNames macro implements

* Consider generics in the impl block + use absolute path for the trait
2019-11-23 20:58:10 -08:00
Herman Venter
e981f240d6 Add checks to guard against overflow in iterator methods. (#76) 2019-11-16 17:33:14 -08:00
Peter Glotfelty
9310855c82
Refactoring code and updating syn + quote (#71)
* Upgrading Syn and Quote to 1.0 and performing refactoring of helpers

* added newlines at the end of some files

* Did additional refactoring and added helpful trait methods to improve readability

* Shortened README and moved content to the wiki

* Updated README and changelog

* ran cargo fmt
2019-09-18 11:24:14 -07:00
tcharding
efed58502a Update attribute docs for strum_discriminants
Currently the README does not mention that extra attributes may be
passed to `#[strum_discriminants()]` and that these will be added as
attributes on the generated enum.  This is a cool feature, we should
document it.
2019-08-16 11:55:16 -07:00
uHOOCCOOHu
00397fe0a3 Add feature derive for re-exporting proc macros. 2019-08-16 11:52:58 -07:00
Evgeniy Dushistov
640c0bb713 Implement serialize_all=UPPERCASE (#48)
* Implement serialize_all=UPPERCASE

* applying rustfmt 1.2.2-stable

* handling of all options listed in serde docs for compatibility

See https://serde.rs/container-attrs.html#container-attributes
2019-07-29 08:26:29 -07:00
Pascal Hertleif
96daaf4021 Add EnumVariantNames (#56)
* Add `EnumVariantNames`

This derive adds a static `variants()` methods yielding the names of
the enum variants. This happens to be exactly what clap [wants][1], and
is the last puzzle piece to use strum with clap/structopt.

[1]: https://docs.rs/clap/2.33.0/clap/macro.arg_enum.html

* Expand readme section for `EnumVariantNames`

* Return slice instead of array

This reduces the risk of breaking the public API by accident when adding
a new variant.

* Fix typo in Readme

* Add generic doc comment to `variants()` method

* Add test case using `variants` in clap/structopt
2019-07-15 10:06:33 -07:00