enumset
A library for creating compact sets of enums.
1.1.14
42M downloads/mo
#1377 most downloaded on crates.io
Lymia/enumset
What this package is like to depend on
Last release 1 months ago
20 Jul 2026
Release timing varies
gaps range from 8 days to 10 months
Most releases are documented
notes for 38 of 52 stable releases
8 versions withdrawn
withdrawn after publishing
9 years old
60 releases · first in 2017
4 releases in the last 12 months
see the full history below
Release timeline
60 releases · Oct 2017 to Jul 2026Releases
latest 60-
1.1.1420 Jul 2026Release notes
Open source →- Fixes building on
#[no_std]targets withserdeenabled. - Small improvements and clarifications to the documentation.
- Fixes building on
-
1.1.1318 May 2026Release notes
Open source →- Revert a semver breaking change introduced in 1.1.12 relating to using
functions like
EnumSet<T>.symmetric_differencewithEnum::A.into(). - Deprecate
EnumSet<T>.symmetrical_differencein favor ofsymmetric_difference, to better match the standard library sets.
- Revert a semver breaking change introduced in 1.1.12 relating to using
functions like
-
1.1.1207 May 2026 withdrawnRelease notes
Open source →- Corrected the mistaken release of 1.1.11 with an outdated version of the
public API for
MixedEnumSet<T>, where it was atenumset::MixedEnumSetinstead ofenumset::set::MixedEnumSetto avoid namespace pollution.
- Corrected the mistaken release of 1.1.11 with an outdated version of the
public API for
-
1.1.1107 May 2026 withdrawnRelease notes
Open source →- Implement a new
MixedEnumSet<T>type that allows unknown bits to be mixed with known enum variants in a single bitset. - Added
FromIteratorimplementations for iterators of borrowed items. - Added
EnumSet::bit_indexandEnumSet::is_bit_validmethods to query the bit associated with an enum variant, or if a bit index is valid. - Fixed a bug causing
#![derive(EnumSetType)]to produce invalid code on big-endian systems. - Allowed
EnumSet<T>to beSendandSync. (Thanks @SLUCHABLUB) - Allow byte literals such as
b'A'to be used as variant discriminants. (Thanks @ronnodas) - Minimum required Rust version is now 1.71+ due to updates in dependencies.
- Minimum required Rust version when the
proc-macro-cratefeature flag cannot be guaranteed. It uses multiple dependencies without a specified minimum version.
- Implement a new
-
1.1.1021 Aug 2025Release notes
Open source →- Improve the macro code to avoid exposing the internal repr of
EnumSetas a public field. - Fixes combinations of
reprandserialize_reprthat previously resulted in errors. - Fixed some minor hygiene issues with the procedural macro.
- Small improvements and clarifications to the documentation.
- Improve the macro code to avoid exposing the internal repr of
-
1.1.917 Aug 2025Release notes
Open source →- Fixes a bug that causes compilation failures when a crate (such as
defmt) exposes a macro calledassert!. (thanks @bugadani)
- Fixes a bug that causes compilation failures when a crate (such as
-
1.1.816 Aug 2025Release notes
Open source →New Features
- Add
From<[T; N]>,Extend<&'a T>, andExtend<&'a EnumSet<T>>implementations toEnumSet<T>. - Added a new
#[enumset(map = "...")]annotation that allows controlling how enum variants are mapped to bits in the underlying bitset.
Enhancements
- Optimizations for sparse bitsets and sets larger than 64 variants.
- Added basic support for specifying enum discriminants via simple
expressions like
1 << 30.
- Add
-
1.1.708 Jul 2025Release notes
Open source →- Fix hygiene issue where the
enumset_set!macro with no arguments requiredEnumSetto be imported into the current context. (Thanks @cbiffle) - Fix issue where
#[derive(EnumSetType)]used to cause compile errors when cross-compiling with different flags on the host and target sides. (Thanks @dtolnay)
- Fix hygiene issue where the
-
1.1.605 May 2025Release notes
Open source →EnumSet::as_repris now const. (Thanks @jasonwhite)- Added support for the
defmtcrate via a new feature. (Thanks @katyo)
-
1.1.522 Jul 2024Release notes
Open source →- Add support for using
EnumSet<T>values in theenum_set!macro. - Added new
enum_set_union!,enum_set_intersection!,enum_set_difference!,enum_set_complement!andenum_set_symmetric_difference!macros for doingEnumSetoperations at compile time.
- Add support for using
-
1.1.422 Jul 2024Release notes
Open source →- The
empty,all,bit_width, andvariant_countfunctions ofEnumSet<T>are now const. - The
EMPTYandALLconsts ofEnumSet<T>are deprecated in favor of theemptyandallfunctions. - The
stdfeature flag has been deprecated in favor of the newproc-macro-cratefeature flag. The feature flag was never used for anystd-specific functionality beyond that crate. - Minimum required Rust version is now 1.61+, due to updates in dependencies
and to allow additional functions to be
const. - Minimum required Rust version when the
stdorproc-macro-cratefeature flags are enabled is now 1.69+. - Minor fixes to documentation. (Thanks @xnuk)
- The
-
1.1.311 Oct 2023Release notes
Open source →- Fix an issue where
EnumSet::iterwas not properly inlined without LTO enabled (such as on debug builds). (thanks @Fuuzetsu) - Added a
Displayimplementation forEnumSet<T>for types whereTimplementsDisplay. (suggested by @tsheinen)
- Fix an issue where
-
1.1.210 May 2023Release notes
Open source →- Fix issue where the code generated by
#[derive(EnumSetType)]would cause a clippy warning.
- Fix issue where the code generated by
-
1.1.108 May 2023Release notes
Open source →- Fix issue where
enumsetdid not build correctly for no_std programs that did not usealloc. (Thanks @shamchak808)
- Fix issue where
-
1.1.008 May 2023Release notes
Open source →- Removed the previous 128 variant limit, allowing for enumsets that are backed by an array rather than a single integer.
- Added
as_array,from_array,from_slice, andcopy_into_slicefunctions toEnumSet<T>. In addition,*_truncatedandtry_*versions of all these functions exist. - Added a
to_vecfunction that returns the same data as the array/slice based functions. This requires theallocfeature. - Added an
EnumSet::<T>::EMPTYconstant to help with initializing empty sets in constant contexts. - Deprecated
#[enumset(serialize_as_list)]in favor of#[enumset(serialize_repr = "list")]. - Deprecated
#[enumset(serialize_as_map)]in favor of#[enumset(serialize_repr = "map")].
-
1.0.1301 May 2023Release notes
Open source →- Updated darling to version 0.20 and syn to version 2.0.
- Added a new
#[enumset(serialize_as_map)]attribute to allow serializingEnumSet<T>as a map of enum variants to boolean values. (Thanks @LizzyFleckenstein03) - Minimum required Rust version is now 1.56+, due to updates in dependencies.
-
1.0.1203 Oct 2022Release notes
Open source →- Updated darling version to reduce compile times when combined with other crates. (Thanks @AlexTMjugador)
-
1.0.1112 Apr 2022Release notes
Open source →- Added support for explicitly specifying the internal representation of
EnumSet<T>using the#[enumset(repr = "...")]annotation. (Thanks @ahcodedthat) - Added new functions for directly converting an EnumSet to and from its internal representation, when it is explicitly specified. (Thanks @ahcodedthat)
- Added new
from_*_uncheckedfunctions that unsafely convert a value into anEnumSet<T>without checking if only valid bits are set.
- Added support for explicitly specifying the internal representation of
-
1.0.1005 Apr 2022Release notes
Open source →- The
proc-macro-cratesupport has been locked behind thestdflag and version1.0.9has been yanked due to a regression that causes enumset to fail to compile on#[no_std]platforms in programs that also useserde. - Introduced new
stdandallocfeature flags. These have no current use beyond the previous change, but will be used in the future.
- The
-
1.0.904 Apr 2022 withdrawnRelease notes
Open source →- Disable unused default features for the
darlingcrate. (Thanks @glandium) - Add a new
#[enumset(no_super_impls)]feature which prevents#[derive(EnumSetType)]from automatically generating implementations ofCopy,Clone,Eq, orPartialEq. (Thanks @ahcodedthat) - Suppressed several clippy warnings.
- Implemented
DoubleEndedIteratorforEnumSetIter. #[derive(EnumSetType)]now usesproc-macro-crateto find the path of theenumsetcrate instead of relying on the user to manually specify it, making it easier to use when the crate has been renamed via cargo.- Minimum required Rust version is now 1.36+, due to updates in dependencies.
- Disable unused default features for the
-
1.0.805 Nov 2021 -
1.0.705 Jul 2021Release notes
Open source →- Added the
#[repr(transparent)]flag toEnumSet<T>to allow for safe usage in FFI code. Note that invalid bits being set in the bitset causes UB, so this should be done with care. (Thanks @Riey)
- Added the
-
1.0.627 Feb 2021 -
1.0.524 Feb 2021Release notes
Open source →- Implemented
core::iter::SumforEnumSet<T>. - Properly acknowledge that the minimum required Rust version is actually 1.34+ and not 1.31+. A retroactive changelog entry has been added to 1.0.0.
- Implemented
-
1.0.408 Feb 2021Release notes
Open source →- Fixes a bug that caused
enumset_deriveto require an import ofEnumSetin the scope to function.
- Fixes a bug that caused
-
1.0.327 Jan 2021Release notes
Open source →- (This version contains no code changes.)
- Redirected badges in the README to point at travis-ci.com instead of .org
- Added
README.md, and the license files to the crate distribution.
-
1.0.225 Jan 2021Release notes
Open source →- Fixed critical error compiling on newer versions of
syncaused by a mistaken import from a private module. (Thanks @ocboogie)
- Fixed critical error compiling on newer versions of
-
1.0.109 Aug 2020 -
1.0.006 Apr 2020Release notes
Open source →Breaking Changes
- [WARNING: Potential silent breaking change] Changed
EnumSet::insertto return whether a value was newly inserted, rather than whether the value already existed in the set. This corresponds better with the behavior ofHashSet::insertandBTreeSet::insert. - Renamed
to_bits/from_bitstoas_u128/from_u128. EnumSet::bit_widthandEnumSet::variant_countnow return au32instead of au8for future-proofing.- Removed
nightlyfeature flag, as it is no longer required. - Minimum required Rust version is now 1.34+.
New features
- Added a series of functions like
as_u128/from_u128for other unsigned numeric types. (e.g.as_u8/from_u8,as_u16/from_u16, etc) - Added variants of
as_u128/from_u128that return anOptioninstead of panicking when the conversion cannot be done. - Added variants of
as_u128/from_u128that truncate unknown bits instead of panicking. - Implemented
Extend<EnumSet<T>>andFromIterator<EnumSet<T>>forEnumSet<T>. (Thanks @manuthambi) - Added an
#[enumset(crate_name = "renamed_enumset")]annotation for handling renamed crates.
Bugfixes
- Fixed a bug where the procedural macro would fail on enums with a repr annotation set. While reprs larger than u8 are supported, negative enum variants or enum variants above 127 are still not currently supported.
- [WARNING: Potential silent breaking change] Changed
-
0.4.519 Feb 2020Release notes
Open source →- Fixed a bug where compilation failed when the
serdeflag was enabled, and another trait that definedserializeordeserializewas in scope.
- Fixed a bug where compilation failed when the
-
0.4.412 Oct 2019Release notes
Open source →- Fixed a bug where
#[enumset(serialize_as_list)]did not work whenResultis shadowed.
- Fixed a bug where
-
0.4.308 Oct 2019 -
0.4.229 Sep 2019Release notes
Open source →- Fixed a bug preventing empty enums and enums with one value from compiling.
-
0.4.128 Sep 2019 -
0.4.007 May 2019Release notes
Open source →- Removed outdated macros and attributes.
- All attributes for the custom derive are now written as
#[enumset(...)] - Implemented
#[enumset(serialize_deny_unknown)] - Implemented
#[enumset(serialize_repr="...")] #[derive(EnumSetType)]now only implementsCopy,Clone,PartialEqandEqautomatically.
-
0.3.1902 May 2019 -
0.3.1817 Apr 2019Release notes
Open source →- Fix an off-by-one error causing enums with 9, 17, 33, etc variants to behave unexpectedly.
-
0.3.1711 Mar 2019Release notes
Open source →- Add an
#[enumset_serialize_as_list]attribute to cause theDeserializeandSerializeimplementations forEnumSet<T>to serialize it as a seq ofTs rather than an integer bitmask.
- Add an
-
0.3.1604 Feb 2019Release notes
Open source →- Added
Defaultimplementation forEnumSet<T>that returns an empty map. (Thanks @boxdot)
- Added
-
0.3.1508 Jan 2019 -
0.3.1409 Nov 2018Release notes
Open source →- Deprecated the
enum_set_type!macro in favor of a custom derive. - Added a way to avoid the automatic operator overloads derived from EnumSetTypes.
- Fixed a major issue that would have prevented
enumsetfrom being used in#[no_std]crates. - Minimum required version is now 1.30.0+. There should be no more need to bump the minimum Rust version in the foreseeable future.
- Deprecated the
-
0.3.1308 Nov 2018 withdrawnNothing published for this version
-
0.3.1217 Sep 2018Nothing published for this version
-
0.3.1129 Jun 2018Nothing published for this version
-
0.3.1025 May 2018Nothing published for this version
-
0.3.925 May 2018Nothing published for this version
-
0.3.825 May 2018Nothing published for this version
-
0.3.725 May 2018 withdrawnNothing published for this version
-
0.3.624 May 2018Nothing published for this version
-
0.3.524 May 2018Nothing published for this version
-
0.3.424 May 2018Nothing published for this version
-
0.3.309 Dec 2017Nothing published for this version
-
0.3.229 Nov 2017Nothing published for this version
-
0.3.129 Nov 2017 withdrawnNothing published for this version
-
0.3.029 Nov 2017 withdrawnNothing published for this version
-
0.2.129 Nov 2017Nothing published for this version
-
0.2.029 Oct 2017 withdrawnNothing published for this version
-
0.1.229 Oct 2017Nothing published for this version
-
0.1.129 Oct 2017Nothing published for this version
-
0.1.029 Oct 2017Nothing published for this version