Crates.io | const_enum_map |
lib.rs | const_enum_map |
version | 0.1.0 |
source | src |
created_at | 2019-10-26 04:52:30.547788 |
updated_at | 2019-10-26 04:52:30.547788 |
description | Get const value from enum handle |
homepage | |
repository | https://github.com/hjiayz/const_enum_map.git |
max_upload_size | |
id | 175831 |
size | 4,417 |
Get const value from enum handle
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