Skip to content

Useful macros for Rust enums

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

cyrgani/enum_macros

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

no_std compability

The crate is fully #![no_std] compatible at the moment. Future versions may introduce a subset of features that require std under a new std crate feature.

About

Useful macros for Rust enums

Topics

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages