All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
Please make sure to add your changes to the appropriate categories:
Added
: for new functionalityChanged
: for changes in existing functionalityDeprecated
: for soon-to-be removed functionalityRemoved
: for removed functionalityFixed
: for fixed bugsPerformance
: for performance-relevant changesSecurity
: for security-relevant changesOther
: for everything else
- n/a
- n/a
- n/a
- n/a
- n/A
- n/a
- n/a
- n/a
- Added enum-level
#[enumcapsulate(discriminant(…))]
helper attribute forVariantDiscriminant
derive macro, allowing for customizingrepr = …
andname = …
for the generated enum. - Added variant-level
#[enumcapsulate(discriminant(…))]
helper attribute forVariantDiscriminant
derive macro, allowing for customizingvalue = …
andname = …
for the generated variant. - Made enum generated by
VariantDiscriminant
derive macro implementOrd + PartialOrd
.
- Bumped MSRV from "1.74.0" to "1.78.0".
- Made the enum-level
#[enumcapsulate(exclude(…))]
helper macros only have an effect on derives, when orchestrated through theEncapsulate
derive macro. - Made
Encapsulate
derive macro no longer deriveVariantDiscriminant
. - Removed potentially confusing
#[enumcapsulate(include(…))]
helper attributes. - Merged
#[enumcapsulate(field(index = …))]
and#[enumcapsulate(field(name = "…"))]
into a single polymorph#[enumcapsulate(field = …)]
- Made enum generated by
VariantDiscriminant
derive macro have the same level of visibility as its source item.
- Added dedicated
trait AsVariant<T>
forAsVariantRef<T>
's removedfn as_variant(&self) -> Option<T>
. - Added dedicated
AsVariant
derive macro fortrait AsVariant<T>
. - Added enum-level
#[enumcapsulate(exclude)]
/#[enumcapsulate(exclude(…))]
helper attribute. - Added optional selection list to variant-level
#[enumcapsulate(exclude(…))]
helper attribute. - Added optional selection list to variant-level
#[enumcapsulate(include(…))]
helper attribute. - Added derive support for generic enums (by force-excluding variants that use generic const/type parameters).
- Removed
enumcapsulate::macros
and its redundantenumcapsulate::derive
module in favor of re-exporting its items directly fromcrate::*
, thus eliminating the need for individually importing trait + derive macro pairs:- Before:
use enumcapsulate::{derive::FromVariant, FromVariant};
- After:
use enumcapsulate::FromVariant;
- Before:
- Made
Encapsulate
derive macro derive also deriveAsVariant<T>
. - Promoted
field
value ofinclude(field = …)
to its own top-level variant attribute with name/index variants:#[enumcapsulate(field(index = …))]
#[enumcapsulate(field(name = "…"))]
- Removed
fn as_variant(&self) -> Option<T>
default trait method fromAsVariantRef<T>
(seeAdded
section for more info). - Removed
IsVariant<T>
trait and correspondingIsVariant
derive macro.
- Added
#[enumcapsulate(exclude)]
derive macro helper attribute for exclude specific variants from getting derives.
- Made derive macros more lenient by ignoring inapplicable variants (i.e. with fewer or more than one field), rather than bailing out.
- Updated dependencies:
enumcapsulate-macros
from0.1.0
to0.2.1
- The
VariantDiscriminant
derive macro now also supports enums with arbitrary variant shapes.
- Updated dependencies:
proc-macro2
from1.0.79
to1.0.81
quote
from1.0.35
to1.0.36
syn
from2.0.53
to2.0.60
- Updated dependencies:
proc-macro2
from1.0.76
to1.0.79
syn
from2.0.48
to2.0.53
- Bumped MSRV from
1.70.0
to1.74.0
Initial release.