pub struct Awaitable<Input, Output>(_);
Expand description
Awaitable guarantees that there is no spurious wakeup
Implementations
sourceimpl<Input, Output> Awaitable<Input, Output>
impl<Input, Output> Awaitable<Input, Output>
sourcepub fn reset(&self, input: Option<Input>)
pub fn reset(&self, input: Option<Input>)
Reset Awaitable
to its initial state.
After this call, install_waker
, take_input
and done
can be called.
sourcepub fn install_waker(&self, waker: Waker) -> Result<bool, Error>
pub fn install_waker(&self, waker: Waker) -> Result<bool, Error>
Return true if the task is already done.
**
install_waker
must not be called after take_output
is called.
**
sourcepub fn take_input(&self) -> Result<Option<Input>, Error>
pub fn take_input(&self) -> Result<Option<Input>, Error>
**take_input
must not be called after take_output
is called.
sourcepub fn done(&self, value: Output) -> Result<(), Error>
pub fn done(&self, value: Output) -> Result<(), Error>
done
must be only called once on one instance of Awaitable
.
done
must not be called after take_output
is called.
sourcepub fn take_output(&self) -> Option<Output>
pub fn take_output(&self) -> Option<Output>
Return Some(output)
if the awaitable is done.
sourcepub fn is_consumed(&self) -> bool
pub fn is_consumed(&self) -> bool
Return true if current state is Consumed
.
Trait Implementations
Auto Trait Implementations
impl<Input, Output> !RefUnwindSafe for Awaitable<Input, Output>
impl<Input, Output> Send for Awaitable<Input, Output>where
Input: Send,
Output: Send,
impl<Input, Output> Sync for Awaitable<Input, Output>where
Input: Send,
Output: Send,
impl<Input, Output> Unpin for Awaitable<Input, Output>where
Input: Unpin,
Output: Unpin,
impl<Input, Output> UnwindSafe for Awaitable<Input, Output>where
Input: UnwindSafe,
Output: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more