lazy_fn
lazy_static
for functions!
Makes the attributed function "lazy"; it will only be evaluated once and the result will be cached and thus returned as a static reference.
Usage
In your Cargo.toml
:
[]
= "1"
= "1"
In your code:
extern crate lazy_fn;
let maths: &'static i32 = maths;
let hello_world: &'static str = hello_world;
let hello_fmt: &'static String = hello_fmt;