3 unstable releases
new 0.2.1 | Jan 16, 2025 |
---|---|
0.2.0 | Jan 9, 2025 |
0.1.0 | Feb 6, 2024 |
#2239 in Procedural macros
238 downloads per month
Used in enutil
12KB
160 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
~220–660KB
~16K SLoC