const_enum_map

Crates.ioconst_enum_map
lib.rsconst_enum_map
version0.1.0
sourcesrc
created_at2019-10-26 04:52:30.547788
updated_at2019-10-26 04:52:30.547788
descriptionGet const value from enum handle
homepage
repositoryhttps://github.com/hjiayz/const_enum_map.git
max_upload_size
id175831
size4,417
ppc (hjiayz)

documentation

README

const_enum_map

Get const value from enum handle

Examples

use const_enum_map::{ConstKey,const_enum_map};

fn item0() -> &'static str {
    "item0"
}
fn item1() -> &'static str {
    "item1"
}
const_enum_map! {
    Foo => fn()->&'static str,
    Item0 => item0,
    Item1 => item1
}

fn main() {
    assert_eq!(Foo::Item0.get()(), "item0");
    assert_eq!(Foo::Item1.get(), Foo::Item1.get());
    assert_eq!(Foo::value_list(), Foo::value_list());
}

License: MIT

Commit count: 3

cargo fmt