enum_macros

Crates.ioenum_macros
lib.rsenum_macros
version0.0.4
created_at2024-07-28 21:26:39.979369+00
updated_at2025-07-02 07:43:45.890214+00
descriptionA collection of useful macros to make working with enums easier.
homepage
repositoryhttps://github.com/cyrgani/enum_macros
max_upload_size
id1318263
size69,307
(cyrgani)

documentation

README

enum-macros

Crates.io Version docs.rs (with version)

A collection of useful macros to make working with enums easier.

Current features

The current set of macros is not fixed yet. More macros will likely be added or removed in the future.

Each macro can be enabled and disabled individually by its respective Cargo feature if it is not wanted. By default, all are enabled.

  • custom_discriminant: allows using arbitrary values as discriminants and converting from and to them
  • marker_type: creates a copy of an enum where no field holds data
  • NextVariant: allows moving forward through the variants of an enum
  • VariantAmount: adds a constant storing the amount of variants the enum has
  • UnwrapVariant: adds methods for unwrapping variants of an enum
Commit count: 20

cargo fmt