We should add proc-macro on top of once-cell with the following API
#[once_cell::once]
fn global_map() -> &'static HashMap<u32, &'static str> {
let mut m = HashMap::new();
m.insert(0, "foo");
m.insert(1, "bar");
m
}
This imo is more transparent than lazy_static's API. Note that, on the call site, there will be a function call instead of Deref, which is less ergonomic, but more obvious: you see where costly initialization might take place.
We should add proc-macro on top of once-cell with the following API
This imo is more transparent than lazy_static's API. Note that, on the call site, there will be a function call instead of Deref, which is less ergonomic, but more obvious: you see where costly initialization might take place.