pub struct OnceState { /* fields omitted */ }🔬 This is a nightly-only experimental API. (
once_poison #33577)
State yielded to call_once_force’s closure parameter. The state can be
used to query the poison status of the Once.
🔬 This is a nightly-only experimental API. (
once_poison #33577)
Returns whether the associated Once was poisoned prior to the
invocation of the closure passed to call_once_force.
A poisoned Once:
#![feature(once_poison)]
use std::sync::Once;
use std::thread;
static INIT: Once = Once::new();
let handle = thread::spawn(|| {
INIT.call_once(|| panic!());
});
assert!(handle.join().is_err());
INIT.call_once_force(|state| {
assert!(state.poisoned());
});Run
An unpoisoned Once:
#![feature(once_poison)]
use std::sync::Once;
static INIT: Once = Once::new();
INIT.call_once_force(|state| {
assert!(!state.poisoned());
});Run
Formats the value using the given formatter. Read more
🔬 This is a nightly-only experimental API. (
try_from #33417)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (
try_from #33417)
🔬 This is a nightly-only experimental API. (
try_from #33417)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (
try_from #33417)
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (get_type_id #27745)
this method will likely be replaced by an associated static