Skip to content

Glossary: Software Design Patterns in Rust

Singleton

Also written: singletons

A single value that everyone shares. In Rust it is a `static`, using `OnceLock` for set-once data or `Mutex` for changeable data, and overuse leads to global state.

Where the book teaches it

Related terms

OnceLockMutexGlobal mutable state