EnumSet::as_repr
is now const. (Thanks @jasonwhite)
- 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 doingEnumSet
operations at compile time.
- The
empty
,all
,bit_width
, andvariant_count
functions ofEnumSet<T>
are now const. - The
EMPTY
andALL
consts ofEnumSet<T>
are deprecated in favor of theempty
andall
functions. - The
std
feature flag has been deprecated in favor of the newconst-proc-macro
feature 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
std
orconst-proc-macro
feature flags are enabled is now 1.69+. - Minor fixes to documentation. (Thanks @xnuk)
- Fix an issue where
EnumSet::iter
was not properly inlined without LTO enabled (such as on debug builds). (thanks @Fuuzetsu) - Added a
Display
implementation forEnumSet<T>
for types whereT
implementsDisplay
. (suggested by @tsheinen)
- Fix issue where the code generated by
#[derive(EnumSetType)]
would cause a clippy warning.
- Fix issue where
enumset
did 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_slice
functions toEnumSet<T>
. In addition,*_truncated
andtry_*
versions of all these functions exist. - Added a
to_vec
function that returns the same data as the array/slice based functions. This requires thealloc
feature. - Added an
EnumSet::<T>::EMPTY
constant 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_*_unchecked
functions that unsafely convert a value into anEnumSet<T>
without checking if only valid bits are set.
- The
proc-macro-crate
support has been locked behind thestd
flag and version1.0.9
has been yanked due to a regression that causes enumset to fail to compile on#[no_std]
platforms in programs that also useserde
. - Introduced new
std
andalloc
feature flags. These have no current use beyond the previous change, but will be used in the future.
- Disable unused default features for the
darling
crate. (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
DoubleEndedIterator
forEnumSetIter
. #[derive(EnumSetType)]
now usesproc-macro-crate
to find the path of theenumset
crate 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
EnumSet
iteration. (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::Sum
forEnumSet<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_derive
to require an import ofEnumSet
in 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
syn
caused by a mistaken import from a private module. (Thanks @ocboogie)
- Implemented
ExactSizeIterator
forEnumSetIter
. (Thanks @dmarcuse)
- [WARNING: Potential silent breaking change] Changed
EnumSet::insert
to return whether a value was newly inserted, rather than whether the value already existed in the set. This corresponds better with the behavior ofHashSet::insert
andBTreeSet::insert
. - Renamed
to_bits
/from_bits
toas_u128
/from_u128
. EnumSet::bit_width
andEnumSet::variant_count
now return au32
instead of au8
for future-proofing.- Removed
nightly
feature flag, as it is no longer required. - Minimum required Rust version is now 1.34+.
- Added a series of functions like
as_u128
/from_u128
for other unsigned numeric types. (e.g.as_u8
/from_u8
,as_u16
/from_u16
, etc) - Added variants of
as_u128
/from_u128
that return anOption
instead of panicking when the conversion cannot be done. - Added variants of
as_u128
/from_u128
that 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
serde
flag was enabled, and another trait that definedserialize
ordeserialize
was in scope.
- Fixed a bug where
#[enumset(serialize_as_list)]
did not work whenResult
is shadowed.
- Implemented
Extend
andFromIterator
forEnumSet<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
,PartialEq
andEq
automatically.
- 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 theDeserialize
andSerialize
implementations forEnumSet<T>
to serialize it as a seq ofT
s rather than an integer bitmask.
- Added
Default
implementation forEnumSet<T>
that returns an empty map. (Thanks @boxdot)
- Added optional
serde
support.
- 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
enumset
from 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.