Crate singleton_cell

Source

Modules§

internal
Macro-only code which must be public

Macros§

new_singleton
Generates a new global singleton type with a fallible constructor. This is intended for cases where a single instance is created early in the program and passed throughout.

Structs§

Erased
The Erased struct witnesses the logical ownership of a value of type T while remaining zero-sized. This can be used for ghost proofs of soundness.
SCell
SCell, or SingletonCell provides an interface of a Ghost Cell, where the Key is allowed to be any singleton, rather than a particular token type.
Token
A temporary singleton token created by the with_token function.

Traits§

Exists
The Exists trait is intended to be used with impl, to denote an argument where the existence of a value is sufficient as an argument
Singleton
This trait denotes a type which has at most one logical identity at all times. This is sufficient to make borrowing decisions based only on the type, without regards to value identity.

Functions§

with_token
Generate a local token type which is guaranteed to be a singleton via a unique lifetime brand. SCells can be created within this scope via SCell::new or SCell::from_mut and used via this token.

Type Aliases§

SingletonCell
A more verbose alias for SCell