1 unstable release

0.1.0 Feb 6, 2024

#23 in #utility-macro


Used in enutil

MIT license

9KB
99 lines

Enum Utility Macros

Enutil includes general utility macros for dealing with enumerators in Rust. The main objective of this crate is to provide macros that reduce boilerplate and/or repetition of (un)commonly seen patterns associated to enumerators in Rust.

Macro Cheatsheet

Macro Description
EnumDeref Implements Deref and DeretMut for a new-type enum based on a common Target

Using enutil

Simply include it in your Cargo.toml with the derive feature.

  • Via Cargo's CLI:

    $ cargo add enutil --features=derive
    
  • Manually:

    # Cargo.toml
    [dependencies]
    enutil = { version = "<type latest version here>", features = ["derive"] }
    

Acknowledgements

This crate's structure and organization has been largely inspired by that seen in Strum. Checkout that crate for other interesting and useful macros.

Why 'enutil'?

It joins the words "Enum" and "Utility", while also sounding like the word "inútil", which is portuguese for "useless".

Dependencies

~230–670KB
~16K SLoC