[−][src]Struct spinning::Once
A synchronization primitive which initializes a value lazily, once. Since this also includes a
value, it is a bit more like Once
from parking_lot
or spin
.
Implementations
impl<T> Once<T>
[src]
pub const fn new() -> Self
[src]
pub const fn uninitialized() -> Self
[src]
pub const fn initialized(value: T) -> Self
[src]
pub fn initialize(&self, value: T) -> Result<(), T>
[src]
pub fn try_call_once<'a, F>(&'a self, init: F) -> Result<&'a T, F> where
F: FnOnce() -> T,
[src]
F: FnOnce() -> T,
pub fn call_once<'a, F>(&'a self, init: F) -> &'a T where
F: FnOnce() -> T,
[src]
F: FnOnce() -> T,
pub fn wait<'a>(&'a self) -> &'a T
[src]
pub fn try_get<'a>(&'a self) -> Option<&'a T>
[src]
pub fn state(&self) -> OnceState
[src]
Trait Implementations
impl<T> Drop for Once<T>
[src]
impl<T: RefUnwindSafe> RefUnwindSafe for Once<T>
[src]
impl<T: Send + Sync> Send for Once<T>
[src]
impl<T: Send + Sync> Sync for Once<T>
[src]
impl<T: UnwindSafe> UnwindSafe for Once<T>
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,