pub unsafe trait Singleton: StableDeref {
    type Type;

    unsafe fn new() -> Self;
    fn get() -> *mut Self::Type;

    fn unwrap(self) -> &'static mut Self::Type
    where
        Self: Sized
, { ... } }
Expand description

An owned singleton: a proxy (handle) for a static mut variable

Required Associated Types§

The type of the static mut variable behind this proxy

Required Methods§

Creates a new singleton

Unsafety

It’s UB to create more than one instance of this singleton

Returns a pointer to the static mut variable behind this proxy

Provided Methods§

Consumes this singleton and returns a &'static mut reference to the variable behind it

Implementors§