- 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.
- 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.
- Fixes a bug that causes compilation failures when a crate (such as
defmt) exposes a macro calledassert!. (thanks @bugadani)
- 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.
- Optimizations for sparse bitsets and sets larger than 64 variants.
- Added basic support for specifying enum discriminators via simple
expressions like
1 << 30.
- 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)
EnumSet::as_repris now const. (Thanks @jasonwhite)- Added support for the
defmtcrate via a new feature. (Thanks @katyo)
- 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.
- 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 newconst-proc-macrofeature 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
stdorconst-proc-macrofeature flags are enabled is now 1.69+. - Minor fixes to documentation. (Thanks @xnuk)
- 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 issue where the code generated by
#[derive(EnumSetType)]would cause a clippy warning.
- Fix issue where
enumsetdid not build correctly for no_std programs that did not usealloc. (Thanks @shamchak808)
- 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")].
- 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.
- Updated darling version to reduce compile times when combined with other crates. (Thanks @AlexTMjugador)
- 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.
- 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.
- 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.
- Optimized
EnumSetiteration. (Thanks @MinusKelvin)
- 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)
- Fix an unneeded warning in the output for
enum_set!for a single value.
- Implemented
core::iter::SumforEnumSet<T>. - Properly acknowledge that the minimum required Rust version is actually 1.34+ and not 1.31+. An retroactive changelog entry has been added to 1.0.0.
- Fixes a bug that caused
enumset_deriveto require an import ofEnumSetin the scope to function.
- (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.
- Fixed critical error compiling on newer versions of
syncaused by a mistaken import from a private module. (Thanks @ocboogie)
- Implemented
ExactSizeIteratorforEnumSetIter. (Thanks @dmarcuse)
- [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+.
- 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.
- 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.
- Fixed a bug where compilation failed when the
serdeflag was enabled, and another trait that definedserializeordeserializewas in scope.
- Fixed a bug where
#[enumset(serialize_as_list)]did not work whenResultis shadowed.
- Implemented
ExtendandFromIteratorforEnumSet<T>.
- Fixed a bug preventing empty enums and enums with one value from compiling.
- Fixed bug in
EnumSetIter::size_hint. (Thanks @manuthambi)
- 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.
- Fix a bug when deserializing enums containing invalid bits set.
- Fix an off-by-one error causing enums with 9, 17, 33, etc variants to behave unexpectedly.
- Add an
#[enumset_serialize_as_list]attribute to cause theDeserializeandSerializeimplementations forEnumSet<T>to serialize it as a seq ofTs rather than an integer bitmask.
- Added
Defaultimplementation forEnumSet<T>that returns an empty map. (Thanks @boxdot)
- Added optional
serdesupport.
- 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 forseeable future.
No release notes were kept for prior versions.