reword 0.3.0

A macro for generating structures for value lookup.
Documentation

reword

Travis Appveyor Crates.io Docs

A macro for generating structures for value lookup.

Examples

Add this to Cargo.toml:

[dependencies]
reword = "0.3"

And this to main.rs:

#[macro_use]
extern crate reword;

reword! {
    enum Lang: &'static str {
        Hi {
            EN_UK | EN_US = "Hi";
            NO = "Hei";
        }
    }
}

fn main() {
    let mut lang = Lang::NO;
    assert_eq!(lang.reword::<Hi>(), "Hei");

    lang = Lang::EN_UK;
    assert_eq!(lang.reword::<Hi>(), "Hi");

    lang = Lang::EN_US;
    assert_eq!(lang.reword::<Hi>(), "Hi");
}

License

Licensed under either of

at your option.

Contribution

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.