enum-map
A map with C-like enum keys represented internally as an array
3.1.0
47M downloads/mo
#1264 most downloaded on crates.io
source
What this package is like to depend on
Last release 1 months ago
21 Jul 2026
Ships unpredictably
gaps range from 8 days to 2.7 years
Some releases are documented
notes for 30 of 73 stable releases
8 versions withdrawn
withdrawn after publishing
9 years old
82 releases · first in 2017
2 releases in the last 12 months
see the full history below
Release timeline
82 releases · May 2017 to Jul 2026Releases
latest 60 of 82-
3.1.021 Jul 2026Release notes
Open source →New features
- Exposed
Arraytrait, to make accessingEnum's length easier.
Incompatible changes
-
Fixed a soundness bug allowing manually created enum implementations with a type mismatch for their
Arraytype. Previously code like this compiled and crashed when executed.impl Enum for IntentionallyWrong { type Array<V> = [String; 4]; fn from_usize(_: usize) -> Self { IntentionallyWrong } fn into_usize(self) -> usize { 0 } } enum_map! { IntentionallyWrong => 42 };Now this is rejected by the compiler.
Release notes
Open source →New features
- Exposed
Arraytrait, to make accessingEnum's length easier.
Incompatible changes
-
Fixed a soundness bug allowing manually created enum implementations with a type mismatch for their
Arraytype. Previously code like this compiled and crashed when executed.struct IntentionallyWrong; impl Enum for IntentionallyWrong { type Array<V> = [String; 4]; fn from_usize(_: usize) -> Self { IntentionallyWrong } fn into_usize(self) -> usize { 0 } } enum_map! { IntentionallyWrong => 42 };Now this is rejected by the compiler.
- Exposed
-
3.0.020 Jul 2026 withdrawnRelease notes
Open source →New features
- Implemented
EnumMap::try_from_fnandEnumMap::try_map. - Added
bytemuckfeature, allowing usingEnumMapwithbytemuckcrate.
Incompatible changes
- Now requires Rust 1.85.
Release notes
Open source →New features
- Implemented
EnumMap::try_from_fnandEnumMap::try_map. - Added
bytemuckfeature, allowing usingEnumMapwithbytemuckcrate.
Incompatible changes
- Now requires Rust 1.85.
- Implemented
-
3.0.0-beta.208 Nov 2023 pre-release withdrawn -
3.0.0-beta.123 Oct 2023 pre-release withdrawnRelease notes
Open source →New features
- Implemented
EnumMap::from_fn. derivefeature is now an optional default feature.
Release notes
Open source →New features
- Implemented
EnumMap::from_fn. derivefeature is now an optional default feature.
- Implemented
-
3.0.0-0.gat.023 Sep 2023 pre-release withdrawnRelease notes
Open source →Breaking changes
EnumandEnumArraytraits are now combined into a single trait using generic associated types. Trait bounds talking aboutEnumArray(likeK: EnumArray<V>) must be replaced withK: Enum.
-
2.7.324 Nov 2023 -
2.7.216 Nov 2023 withdrawnRelease notes
Open source →Other changes
- Reduced RAM usage and improved compilation times when using
derive(Enum)
for large enums withoverflow-checksenabled.
Release notes
Open source →Other changes
- Reduced RAM usage and improved compilation times when using
derive(Enum)for large enums withoverflow-checksenabled.
- Reduced RAM usage and improved compilation times when using
-
2.7.108 Nov 2023 -
2.7.020 Oct 2023 -
2.6.310 Sep 2023Release notes
Open source →Other changes
-
Updated the repository URL as the project was migrated from GitHub to Codeberg.
-
This project is now compliant with the REUSE Specification.
Release notes
Open source →Other changes
-
Updated the repository URL as the project was migrated from GitHub to Codeberg.
-
This project is now compliant with the REUSE Specification.
-
-
2.6.207 Sep 2023 -
2.6.101 Aug 2023Release notes
Open source →Other changes
- Provide better panic message when providing out-of-bounds index to `Enum::from_usize``.
Release notes
Open source →Other changes
- Provide better panic message when providing out-of-bounds index to `Enum::from_usize``.
-
2.6.030 Jun 2023Release notes
Open source →New features
EnumMap::as_arrayis now usable in const contexts.
Other changes
-
This crate now follows "N minus two" MSRV policy. This means that it supports the current Rust release, as well as the two before that.
-
Upgraded syn to 2.0.0.
Release notes
Open source →New features
EnumMap::as_arrayis now usable in const contexts.
Other changes
-
This crate now follows "N minus two" MSRV policy. This means that it supports the current Rust release, as well as the two before that.
-
Upgraded syn to 2.0.0.
-
2.5.014 Mar 2023Release notes
Open source →New features
- Implemented
EnumMap::as_arrayandEnumMap::as_mut_array(implemented by @Fuuzetsu). - Implemented
PartialOrdandOrdforEnumMap(implemented by @nicarran).
New Contributors
- @nicarran made their first contribution in https://github.com/xfix/enum-map/pull/37
- @Fuuzetsu made their first contribution in https://github.com/xfix/enum-map/pull/29
Full Changelog: https://github.com/xfix/enum-map/compare/v2.4.2...v2.5.0
- Implemented
-
2.4.217 Dec 2022Release notes
Open source →Other changes
- Added license files to crate tarball.
- Added changelog to crate tarball.
New Contributors
- @michel-slm made their first contribution in https://github.com/xfix/enum-map/pull/33
Full Changelog: https://github.com/xfix/enum-map/compare/v2.4.1...v2.4.2
Release notes
Open source →Other changes
- Added license files to crate tarball.
- Added changelog to crate tarball.
-
2.4.128 Jul 2022Release notes
Open source →Other changes
- Improved performance of code generated for
from_usizewhen derivingEnum. Fixes #23.
Release notes
Open source →Other changes
- Improved performance of code generated for
from_usizewhen derivingEnum.
- Improved performance of code generated for
-
2.4.015 Jun 2022Release notes
Open source →New features
-
Implemented
Enumfor()(unit type) andcore::cmp::Ordering(implemented by @phimuemue). -
Implemented
EnumMap::into_array.
Release notes
Open source →New features
-
Implemented
Enumfor()(unit type) andcore::cmp::Ordering(implemented by @phimuemue). -
Implemented
EnumMap::into_array.
-
-
2.3.029 May 2022Release notes
Open source →New features
EnumMap::lenis now usable in const contexts.
Other changes
Enumderive now can deal with re-definitions ofusizeand
unimplemented.
Release notes
Open source →New features
EnumMap::lenis now usable in const contexts.
Other changes
Enumderive now can deal with re-definitions ofusizeandunimplemented.
-
2.2.020 May 2022 -
2.1.024 Mar 2022Release notes
Open source →New features
-
Implemented
DoubleEndedIteratorforIntoIter. -
Implemented
EnumMap::into_values.
Other changes
- Changed behavior of
IntoIterso that it drops rest of the elements when one destructor panics.
-
-
2.0.326 Feb 2022 -
2.0.217 Feb 2022Release notes
Open source →Other changes
- Fixed safety problem when using
enum_map!macro with enums that incorrectly implementedEnumtrait.
- Fixed safety problem when using
-
2.0.127 Jan 2022 withdrawn -
2.0.010 Jan 2022 withdrawnRelease notes
Open source →New features
-
Implemented
FromIteratorforEnumMap(implemented by @bit_network on GitLab). -
Implemented
EnumMap::map. -
Derives support product types in addition to sum types (implemented by @bzim on GitLab).
-
It's now possible to access enum length by accessing
LENGTHinEnumtrait.
Breaking changes
Enumtrait was split into two traits,EnumandEnumArray.
-
-
2.0.0-204 Jan 2022 pre-release withdrawnNothing published for this version
-
2.0.0-101 Oct 2021 pre-releaseNothing published for this version
-
1.1.116 May 2021Release notes
Open source →Other changes
- Worked around a bug in Clippy that caused false positives when using
use_selflint for code that derivedEnumtrait.
- Worked around a bug in Clippy that caused false positives when using
-
1.1.004 May 2021Release notes
Open source →New features
- Implemented
Arbitraryfor maps where the value type also implementsArbitrary. (You have to enable the "arbitrary" feature.)
- Implemented
-
1.0.028 Mar 2021Release notes
Open source →New features
-
It's now possible to use
returnand?withinmacro_rules!macro. -
Enumtrait is much simpler having two methods only.
Other changes
-
Removed previously deprecated features.
-
Renamed
to_usizetointo_usizematching the naming convention used in Rust programming language.
-
-
0.6.618 Feb 2022Nothing published for this version
-
0.6.518 Feb 2022Release notes
Open source →Other changes
- Deprecated
EnumMap::is_emptyandEnumMap::new.EnumMap::newusages can be replaced withEnumMap::default.
- Deprecated
-
0.6.427 Oct 2020 -
0.6.308 Sep 2020 -
0.6.220 Dec 2019 -
0.6.104 Oct 2019Nothing published for this version
-
0.6.029 Jul 2019 -
0.5.018 Jan 2019Release notes
Open source →- Fixed the issue where an aliasing
Fromtrait implementation caused compilation errors withenum_map!macro.
Incompatible changes
- Now requires Rust 1.31.
- Fixed the issue where an aliasing
-
0.4.111 Jun 2018Release notes
Open source →New features
- Default
serdefeatures are disabled. This allows enabling serde feature when compiling withoutstd.
- Default
-
0.4.006 Jun 2018Release notes
Open source →Change of
#[derive(EnumMap)]to#[derive(Enum)]was supposed to appear in 0.3.0, but it was forgotten about. This release fixes just that.Incompatible changes
- Changed
#[derive(EnumMap)]to#[derive(Enum)]to match trait name.
- Changed
-
0.3.211 Jun 2018Nothing published for this version
-
0.3.106 Jun 2018 -
0.3.005 Jun 2018Release notes
Open source →New features
-
Implemented compact serde serialization for binary formats like bincode.
-
Iterator traits with exception now implement
FusedIterator.
Incompatible changes
-
Increased required Rust version to 1.26.0.
-
Renamed
Internaltrait toEnum. -
Added new associated constant
POSSIBLE_VALUEStoEnumtrait, representing the number of possible values the type can have. Manual implementations are required to provide it. -
Removed
Enumimplementation forOption<T>. -
Implemented compact serialization, for formats like
bincode. This makes it impossible to deserialize non-compact representation used by enum-map 0.2.0. -
valuesmethod returnsValues<V>as opposed toslice::Iter<V>.
-
-
0.2.3611 Jun 2018Nothing published for this version
-
0.2.3506 Jun 2018Nothing published for this version
-
0.2.3405 Jun 2018Nothing published for this version
-
0.2.3305 Jun 2018Nothing published for this version
-
0.2.3205 Jun 2018Nothing published for this version
-
0.2.3122 May 2018Nothing published for this version
-
0.2.3018 May 2018Nothing published for this version
-
0.2.2920 Apr 2018Nothing published for this version
-
0.2.2809 Apr 2018Nothing published for this version
-
0.2.2730 Mar 2018Nothing published for this version
-
0.2.2630 Mar 2018Nothing published for this version
-
0.2.2530 Mar 2018Nothing published for this version
-
0.2.2417 Jan 2018Nothing published for this version
-
0.2.2330 Nov 2017Nothing published for this version
-
0.2.2218 Nov 2017Nothing published for this version
-
0.2.2106 Nov 2017Nothing published for this version
-
0.2.2015 Sep 2017Nothing published for this version
-
0.2.1911 Sep 2017Nothing published for this version