Struct swiss_army_knife::StaticInitializedOnce
source · [−]pub struct StaticInitializedOnce<Value: Sized> { /* private fields */ }
Expand description
A wrapper type to use with mutable static fields where one does not want the overhead and inflexibility of lazy_static!
.
Implementations
sourceimpl<Value: Sized> StaticInitializedOnce<Value>
impl<Value: Sized> StaticInitializedOnce<Value>
sourcepub const fn uninitialized() -> Self
pub const fn uninitialized() -> Self
Uninitialized value suitable for use in a static.
sourcepub fn initialize_once(&mut self, value: Value) -> &mut Value
pub fn initialize_once(&mut self, value: Value) -> &mut Value
Initialize once.
Not thread safe; indeed, may panic in debug mode.
sourcepub fn value_mut(&mut self) -> &'static mut Value
pub fn value_mut(&mut self) -> &'static mut Value
Value.
Auto Trait Implementations
impl<Value> RefUnwindSafe for StaticInitializedOnce<Value> where
Value: RefUnwindSafe,
impl<Value> Send for StaticInitializedOnce<Value> where
Value: Send,
impl<Value> Sync for StaticInitializedOnce<Value> where
Value: Sync,
impl<Value> Unpin for StaticInitializedOnce<Value> where
Value: Unpin,
impl<Value> UnwindSafe for StaticInitializedOnce<Value> where
Value: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more