Quoting: rust-dominator/lib.rs at master · Pauan/rust-dominator · GitHub
static ROOT_CLASS: Lazy<String> = Lazy::new(|| class! {
.style("display", "inline-block")
.style("background-color", "black")
.style("padding", "10px")
});
Quoting Lazy in once_cell::sync - Rust
A value which is initialized on the first access. This type is thread-safe and can be used in statics.
Can someone please enlighten me on:
-
Why we need this to be
Lazy<String>
instead of regularString
? -
How once_cell::sync::Lazy differs from lazy_static!