Intermediate Rust
Q84 / 100

What is Rust's once_cell crate and how is it now in std?

Correct! Well done.

Incorrect.

The correct answer is B) A crate providing OnceCell<T> and OnceLock<T> for lazy one-time initialization; stabilized as std::cell::OnceLock and std::sync::OnceLock in Rust 1.70

B

Correct Answer

A crate providing OnceCell<T> and OnceLock<T> for lazy one-time initialization; stabilized as std::cell::OnceLock and std::sync::OnceLock in Rust 1.70

Explanation

static LOG: OnceLock<Logger> = OnceLock::new(); LOG.get_or_init(|| Logger::new()) initializes exactly once across all threads. Replaces lazy_static! macro.

Progress
84/100