Registry / utility / once-cell

once-cell

JSON →
library1.21.4rscratesunverified

Single assignment cells and lazy values.

# Cargo.toml [dependencies] once_cell = "1.21.4"
INSTALL
IMPORT
SIG · ONCE-CELL
O
once-cell
utilityrustv1.21.4
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Lazy
use once_cell::sync::Lazy;

Defines a lazy static variable that initializes on first access.

use once_cell::sync::Lazy; static CONFIG: Lazy<String> = Lazy::new(|| std::env::var("HOME").unwrap()); fn main() { println!("Home: {}", *CONFIG); }
Debug
Known issues

No known issues recorded.

Upgrade
Version history
1.21.4latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
once-cell — cargo add once-cell · libregistry