Skip to main content

macro.phf_map

macro_rules! phf_map {
    #[::proc_macro_hack::proc_macro_hack] => { ... };
}

Macro to create a static (compile-time) Map.

Requires the "macros" feature.

Example#

โ“˜

use ::phf::{phf_map, Map};

static MY_MAP: Map<&'static str, u32> = phf_map! {
    "hello" => 1,
    "world" => 2,
};

fn main ()
{
    assert_eq!(MY_MAP["hello"], 1);
}