You are viewing...

One of the Reasons I Love Rust Macros

Updated on October 09, 2020 at the 00th hour
Posted under:

DISCLAIMER: Expressed views on this blog are my own.

You just can't beat this feature.

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

static MAP: Map<char, &'static str> = phf_map! {
    'a' => "apple",
    'b' => "bear",
    'c' => "cat",

Makes it so easy to create a very fast constant static hashmap at build time. You just can't beat it.. you just can't.

You just read "One of the Reasons I Love Rust Macros". Please share if you liked it!
You can read more recent posts here.