From 538a165cee906c0475b996f550409ddc9b4369ce Mon Sep 17 00:00:00 2001 From: Peter Glotfelty Date: Sat, 27 Jan 2024 11:14:50 -0800 Subject: [PATCH] Fix a couple of typos in the changelog --- CHANGELOG.md | 11 +++++++---- README.md | 2 +- strum_macros/src/lib.rs | 2 +- strum_nostd_tests/Cargo.toml | 2 +- strum_tests/Cargo.toml | 2 +- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d97da53..7a031653 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,8 @@ added the implementation in your code. * `Display` now supports format strings using named fields in the enum variant. This should be a no-op for most code. However, if you were outputting a string like `"Hello {field}"`, this will now be interpretted as a format string. - +* EnumDiscriminant now inherits the repr and discriminant values from your main enum. This makes the discriminant type + closer to a mirror of the original and that's always the goal. ### New features @@ -33,14 +34,14 @@ } ``` -* The `EnumMap` macro has been *experimentally* added. This macro adds a new type that stores an item for each variant +* The `EnumTable` macro has been *experimentally* added. This macro adds a new type that stores an item for each variant of the enum. This is useful for storing a value for each variant of an enum. This is an experimental feature because I'm not convinced the current api surface area is correct. ```rust - use strum::EnumMap; + use strum::EnumTable; - #[derive(Copy, Clone, Debug, EnumMap)] + #[derive(Copy, Clone, Debug, EnumTable)] enum Color { Red, Blue, @@ -74,6 +75,8 @@ * [#297](https://github.com/Peternator7/strum/pull/297): New macro, add `VariantArray` * [#296](https://github.com/Peternator7/strum/pull/296): adds prefix attribute to To/From String macros. * [#294](https://github.com/Peternator7/strum/pull/294): use named enum fields in to_string macro. +* [#288](https://github.com/Peternator7/strum/pull/288): discriminant enums now inherit the repr from the original enum. +* [#279](https://github.com/Peternator7/strum/pull/279): Add `EnumTable` macro to generate a mapping between fieldless variants and data. ## 0.25.3 (strum_macros) diff --git a/README.md b/README.md index 51072275..40994394 100644 --- a/README.md +++ b/README.md @@ -85,4 +85,4 @@ Strumming is also a very whimsical motion, much like writing Rust code. [FromRepr]: https://docs.rs/strum_macros/latest/strum_macros/derive.FromRepr.html [VariantArray]: https://docs.rs/strum_macros/latest/strum_macros/derive.StaticVariantsArray.html [VariantNames]: https://docs.rs/strum_macros/latest/strum_macros/derive.EnumVariantNames.html -[EnumTable]: https://docs.rs/strum_macros/latest/strum_macros/derive.EnumMap.html +[EnumTable]: https://docs.rs/strum_macros/latest/strum_macros/derive.EnumTable.html diff --git a/strum_macros/src/lib.rs b/strum_macros/src/lib.rs index 3a5e9854..72f8a37b 100644 --- a/strum_macros/src/lib.rs +++ b/strum_macros/src/lib.rs @@ -516,7 +516,7 @@ pub fn enum_try_as(input: proc_macro::TokenStream) -> proc_macro::TokenStream { /// This macro only supports enums with unit type variants.A new type called `YourEnumTable`. Essentially, it's a wrapper /// `[T; YourEnum::Count]` where gets/sets are infallible. Some important caveats to note: /// -/// * The size of `YourEnumMap` increases with the number of variants, not the number of values because it's always +/// * The size of `YourEnumTable` increases with the number of variants, not the number of values because it's always /// fully populated. This means it may not be a good choice for sparsely populated maps. /// /// * Lookups are basically constant time since it's functionally an array index. diff --git a/strum_nostd_tests/Cargo.toml b/strum_nostd_tests/Cargo.toml index 64036384..9129c4a6 100644 --- a/strum_nostd_tests/Cargo.toml +++ b/strum_nostd_tests/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "strum_nostd_tests" -version = "0.25.0" +version = "0.26.0" edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/strum_tests/Cargo.toml b/strum_tests/Cargo.toml index 3f28b1c7..d166a6b2 100644 --- a/strum_tests/Cargo.toml +++ b/strum_tests/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "strum_tests" -version = "0.25.0" +version = "0.26.0" edition = "2018" authors = ["Peter Glotfelty "]