Skip to content
Free public beta until December 4, 2026: every course is open, no card needed. After that, the first chapter of each course stays free and full access is a one-time $39 ($19 for up to 100 founding members chosen for helpful feedback). Your progress is kept. How the beta works

lazy initialization

Creating a value the first time it's needed instead of at startup.

OnceLock is set at most once and read many times; LazyLock runs its initializer on first access; both are thread-safe and usable in statics.

Examples

  • static CONFIG: LazyLock<String> = LazyLock::new(|| load()); runs load on the first access only, even when several threads read CONFIG.

Read the full section →