### OnceCell API Overview Source: https://github.com/matklad/once_cell/blob/master/README.md Illustrates the basic API for OnceCell, including initialization, setting a value, and retrieving it. ```rust impl OnceCell { fn new() -> OnceCell { ... } fn set(&self, value: T) -> Result<(), T> { ... } fn get(&self) -> Option<&T> { ... } } ``` -------------------------------- ### Lazy Initialization with sync::Lazy Source: https://github.com/matklad/once_cell/blob/master/README.md Demonstrates using `sync::Lazy` to lazily initialize a static Mutex-protected HashMap, providing a macro-free alternative to lazy_static!. ```rust use std::{sync::Mutex, collections::HashMap}; use once_cell::sync::Lazy; static GLOBAL_DATA: Lazy>> = Lazy::new(|| { let mut m = HashMap::new(); m.insert(13, "Spica".to_string()); m.insert(74, "Hoyten".to_string()); Mutex::new(m) }); fn main() { println!("{:?}", GLOBAL_DATA.lock().unwrap()); } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.