#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

#2 in #procedural-macro

Download history 4/week @ 2023-12-25 5/week @ 2024-01-08 8/week @ 2024-02-19 25/week @ 2024-02-26 5/week @ 2024-03-04 13/week @ 2024-03-11 14/week @ 2024-03-25 75/week @ 2024-04-01

103 downloads per month
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
~18K SLoC