#enums #conversion #proc-macro #convenience #auto-implementation

macro enum_unwrapper

Small library for easily converting from user-defined enumerations to the types in the enumeration variants

3 releases

0.1.2 Aug 4, 2023
0.1.1 Aug 4, 2023
0.1.0 Aug 3, 2023

#6 in #procedural-macro


Used in structinator_traits

Apache-2.0

7KB

This is a library designed to ease the process of "unwrapping" enums to access the data within. After attaching the attribute #[unique_try_froms] to an enum definition, checked conversion through try_from is possible to any unique value type in the enum. For more information, check this library's documentation below.


lib.rs:

Enum Unwrapper

enum_unwrapper is a lightweight procedural macro for "unwrapping" enums into their inner types when the variant is known through automatic implementation of TryFrom.

enum_unrapper does this by allowing the user to add a procedural macro attribute, [macro@unique_try_froms] to enum definitions.

For more information and examples, check the attribute's documentation.

Dependencies

~315–770KB
~19K SLoC