Provides a macro to generate structures used for value lookup.
```rust reword::reword! { enum Lang: &'static str { fn hi { NO = "Hei"; ENUK | ENUS = "Hi"; }
fn fall {
NO = "Høst";
EN_UK = "Autumn";
EN_US = "Fall";
}
}
}
let mut lang = Lang::NO; asserteq!(lang.hi(), "Hei"); asserteq!(lang.fall(), "Høst"); lang = Lang::ENUK; asserteq!(lang.hi(), "Hi"); asserteq!(lang.fall(), "Autumn"); lang = Lang::ENUS; asserteq!(lang.hi(), "Hi"); asserteq!(lang.fall(), "Fall"); ```
Attributes can be attached to both the enum
and the methods generated.
The Copy
, Clone
, Debug
, Eq
, PartialEq
, Ord
, PartialOrd
, and Hash
traits are
automatically derived for the enum
using the derive attribute.
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.