OnceLock — thread-safe lazy init. OnceCell — single-threaded lazy init.
OnceLock:
OnceCell:
1use std::sync::OnceLock;23static DATA: OnceLock<String> = OnceLock::new();45fn get_data() -> &'static str {6 DATA.get_or_init(|| String::from("hello"))7}
Key: OnceLock for threads, OnceCell for single thread.