Safe casting for newtype enums and their variants.
The enumcapsulate
crate exports the following traits:
Traits | Functionality |
---|---|
AsVariant |
Umbrella derive macro for AsVariantRef , and AsVariantMut |
AsVariantMut |
Used to do a cheap mutable-to-mutable reference conversion between an outer enum's and its inner variant's type |
AsVariantRef |
Used to do a cheap reference-to-reference reference conversion between an outer enum's and its inner variant's type |
Encapsulate |
Umbrella derive macro for AsVariantMut , AsVariantRef , From , FromVariant , IntoVariant , IsVariant , TryInto , VariantDiscriminant , and VariantDowncast AsVariantMut |
FromVariant |
Used to do variant-to-enum conversions between an outer enum's and its inner variant's type |
IntoVariant |
Used to do enum-to-variant conversions between an outer enum's and its inner variant's type |
IsVariant |
Used to check type of an enum's inner variant's type |
VariantDiscriminant |
Used to obtain an enum variant's discriminant |
VariantDowncast |
Convenience umbrella trait utilizing AsVariantRef , AsVariantMut , and IntoVariant |
as well as the following corresponding derive macros via enumcapsulate::derive::*
:
AsVariant
AsVariantMut
AsVariantRef
Encapsulate
From
FromVariant
IntoVariant
IsVariant
TryInto
VariantDiscriminant
Please refer to the documentation on docs.rs.
Please read CONTRIBUTING.md for details on our code of conduct,
and the process for submitting pull requests to us.
We use SemVer for versioning. For the versions available, see the tags on this repository.
This project is licensed under the MPL-2.0 – see the LICENSE.md file for details.