Macro once_cell::sync_lazy [−][src]
macro_rules! sync_lazy { ($($block:tt)*) => { ... }; }
Creates a new lazy value initialized by the given closure block.
This macro works in const contexts.
If you need a move
closure, use Lazy::new
constructor function.
Example
let hello = "Hello, World!".to_string(); let lazy = sync_lazy! { hello.to_uppercase() }; assert_eq!(&*lazy, "HELLO, WORLD!");