Struct OnceState
pub struct OnceState { pub(crate) inner: OnceState }
State yielded to [Once::call_once_force()]’s closure parameter. The state
can be used to query the poison status of the Once.
Fields
inner: OnceState
Implementations
impl OnceState
fn is_poisoned(&self) -> boolReturns
trueif the associatedOncewas poisoned prior to the invocation of the closure passed to [Once::call_once_force()].Examples
A poisoned [
Once]:use Once; use thread; static INIT: Once = new; // poison the once let handle = spawn; assert!; INIT.call_once_force;An unpoisoned [
Once]:use Once; static INIT: Once = new; INIT.call_once_force;fn poison(&self)Poison the associated
Oncewithout explicitly panicking.
Trait Implementations
impl Debug for OnceState
fn fmt(&self, f: &mut Formatter<'_>) -> Result
Auto Trait Implementations
impl !Freeze for OnceState
impl !RefUnwindSafe for OnceState
impl !Sync for OnceState
impl Send for OnceState
impl Unpin for OnceState
impl UnsafeUnpin for OnceState
impl UnwindSafe for OnceState
Blanket Implementations
impl<T> Any for OnceState
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for OnceState
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for OnceState
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> From<T> for OnceState
fn from(t: T) -> TReturns the argument unchanged.
impl<T> SizeHint for OnceState
where
T: ?Sized,
fn lower_bound(&self) -> usizefn upper_bound(&self) -> Option<usize>
impl<T> SizedTypeProperties for OnceState
impl<T, U> Into<U> for OnceState
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for OnceState
where
U: Into<T>,
type Error = Infallible;fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto<U> for OnceState
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>