phf 0.6.9

Runtime support for perfect hash function data structures
docs.rs failed to build phf-0.6.9
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: phf-0.11.2

Compile time optimized maps and sets.

Keys can be string literals, byte string literals, byte literals, char literals, or any of the fixed-size isizeegral types.

Examples

#![feature(plugin)]
#![plugin(phf_macros)]

extern crate phf;

#[derive(Clone)]
pub enum Keyword {
    Loop,
    Continue,
    Break,
    Fn,
    Extern,
}

static KEYWORDS: phf::Map<&'static str, Keyword> = phf_map! {
    "loop" => Keyword::Loop,
    "continue" => Keyword::Continue,
    "break" => Keyword::Break,
    "fn" => Keyword::Fn,
    "extern" => Keyword::Extern,
};

pub fn parse_keyword(keyword: &str) -> Option<Keyword> {
    KEYWORDS.get(keyword).cloned()
}
# fn main() {}