pub struct Deferred<A, E> { /* private fields */ }Expand description
Shared one-shot cell completed with an Exit value.
Implementations§
Source§impl<A, E> Deferred<A, E>
impl<A, E> Deferred<A, E>
Sourcepub fn make() -> Effect<Deferred<A, E>, Never, ()>
pub fn make() -> Effect<Deferred<A, E>, Never, ()>
Create an incomplete deferred (watch value starts at None).
Sourcepub fn wait_future(
&self,
) -> impl Future<Output = Result<A, Cause<E>>> + Send + 'static
pub fn wait_future( &self, ) -> impl Future<Output = Result<A, Cause<E>>> + Send + 'static
Like Self::wait, but returns a Send future for use inside tokio::spawn and other
multi-thread executors (the boxed Effect future from Effect::run is not Send).
Sourcepub fn try_succeed(&self, value: A) -> boolwhere
A: Clone,
pub fn try_succeed(&self, value: A) -> boolwhere
A: Clone,
Try to complete with success (non-blocking). Returns whether this was the first completion.
Sourcepub fn try_fail_cause(&self, cause: Cause<E>) -> boolwhere
E: Clone,
pub fn try_fail_cause(&self, cause: Cause<E>) -> boolwhere
E: Clone,
Try to complete with a failure Cause (non-blocking).
Sourcepub fn poll(&self) -> Effect<Option<Exit<A, E>>, Never, ()>
pub fn poll(&self) -> Effect<Option<Exit<A, E>>, Never, ()>
Non-blocking read of the current exit, if any.
Sourcepub fn is_done(&self) -> Effect<bool, Never, ()>
pub fn is_done(&self) -> Effect<bool, Never, ()>
Returns whether this deferred has been completed (watch value is Some).
Sourcepub fn succeed(&self, value: A) -> Effect<bool, Never, ()>
pub fn succeed(&self, value: A) -> Effect<bool, Never, ()>
Complete with success. Returns true if this was the first completion.
Sourcepub fn fail(&self, error: E) -> Effect<bool, Never, ()>
pub fn fail(&self, error: E) -> Effect<bool, Never, ()>
Complete with Exit::fail. Returns true if this was the first completion.
Sourcepub fn fail_cause(&self, cause: Cause<E>) -> Effect<bool, Never, ()>
pub fn fail_cause(&self, cause: Cause<E>) -> Effect<bool, Never, ()>
Complete with an arbitrary Cause. Returns true if this was the first completion.
Sourcepub fn interrupt(&self) -> Effect<bool, Never, ()>
pub fn interrupt(&self) -> Effect<bool, Never, ()>
Complete with Exit::interrupt. Returns true if this was the first completion.