doc.rust-lang.org
pub struct OnceLock<T>
A synchronization primitive which can nominally be written to only once.
struct
std
Stable since 1.70.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn is_poisoned(&self) -> bool
Returns true if the associated Once was poisoned prior to the invocation of the closure passed to Once::call_once_force().
method
std
Stable since 1.51.0
Version 1.100.0-nightly
doc.rust-lang.org
pub struct OnceState
State yielded to Once::call_once_force()’s closure parameter. The state can be used to query the poison status of the Once.
struct
std
Stable since 1.51.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn wait_force(&self)
Blocks the current thread until initialization has completed, ignoring poisoning.
method
std
Stable since 1.86.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn wait(&self)
Blocks the current thread until initialization has completed.
method
std
Stable since 1.86.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn new() -> Once
Creates a new Once value.
associated_function
std
Stable since 1.2.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn is_completed(&self) -> bool
Returns true if some call_once() call has completed successfully. Specifically, is_completed will return false in the following situations:
method
std
Stable since 1.43.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn call_once_force<F>(&self, f: F)
Performs the same function as call_once() except ignores poisoning.
method
std
Stable since 1.51.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn call_once<F>(&self, f: F)
Performs an initialization routine once and only once. The given closure will be executed if this is the first time call_once has been called, and otherwise the routine will not be invoked.
method
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub struct Once
A low-level synchronization primitive for one-time global execution.
struct
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const ONCE_INIT: Once
Initialization value for static Once values.
constant
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn sync_channel<T>(bound: usize) -> (SyncSender<T>, Receiver<T>)
Creates a new synchronous, bounded channel.
function
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn channel<T>() -> (Sender<T>, Receiver<T>)
Creates a new asynchronous channel, returning the sender/receiver halves.
function
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub enum TrySendError<T>
This enumeration is the list of the possible error outcomes for the try_send method.
enum
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub enum TryRecvError
This enumeration is the list of the possible reasons that try_recv could not return data when called. This can occur with both a channel and a sync_channel.
enum
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub struct TryIter<'a, T>
An iterator that attempts to yield all pending values for a Receiver, created by try_iter.
struct
std
Stable since 1.15.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn try_send(&self, t: T) -> Result<(), TrySendError<T>>
Attempts to send a value on this channel without blocking.
method
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn send(&self, t: T) -> Result<(), SendError<T>>
Sends a value on this synchronous channel.
method
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub struct SyncSender<T>
The sending-half of Rust's synchronous sync_channel type.
struct
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn send(&self, t: T) -> Result<(), SendError<T>>
Attempts to send a value on this channel, returning it back if it could not be sent.
method
std
Stable since 1.0.0
Version 1.100.0-nightly