Struct grafix_toolbox::uses::Sync::sync::OnceState 1.51.0[−][src]
pub struct OnceState { /* fields omitted */ }Expand description
State yielded to Once::call_once_force()’s closure parameter. The state
can be used to query the poison status of the Once.
Implementations
Returns true if the associated Once was poisoned prior to the
invocation of the closure passed to Once::call_once_force().
Examples
A poisoned Once:
use std::sync::Once; use std::thread; static INIT: Once = Once::new(); // poison the once let handle = thread::spawn(|| { INIT.call_once(|| panic!()); }); assert!(handle.join().is_err()); INIT.call_once_force(|state| { assert!(state.is_poisoned()); });
An unpoisoned Once:
use std::sync::Once; static INIT: Once = Once::new(); INIT.call_once_force(|state| { assert!(!state.is_poisoned()); });
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for OnceStateimpl UnwindSafe for OnceStateBlanket Implementations
Mutably borrows from an owned value. Read more
type Output = T
type Output = TShould always be Self
The inverse inclusion map: attempts to construct self from the equivalent element of its
superset. Read more
pub fn is_in_subset(&self) -> bool
pub fn is_in_subset(&self) -> boolChecks if self is actually part of its subset T (and can be converted to it).
pub fn to_subset_unchecked(&self) -> SS
pub fn to_subset_unchecked(&self) -> SSUse with care! Same as self.to_subset but without any property checks. Always succeeds.
pub fn from_subset(element: &SS) -> SP
pub fn from_subset(element: &SS) -> SPThe inclusion map: converts self to the equivalent element of its superset.
pub fn vzip(self) -> V