pub enum AsyncResult<T> {
Pending,
Completed(T),
Consumed,
}
Expand description
The result of a successful call to an async poller operation such as in System
.
Variants§
Pending
The async operation is still pending and has not completed.
Completed(T)
The async operation completed with the given value.
Consumed
The async operation was completed and the result was already consumed.
Implementations§
Source§impl<T> AsyncResult<T>
impl<T> AsyncResult<T>
Sourcepub fn new() -> Self
pub fn new() -> Self
Constructs a new async result handle in the AsyncResult::Pending
state.
Sourcepub fn complete(&mut self, value: T) -> Result<(), T>
pub fn complete(&mut self, value: T) -> Result<(), T>
Transitions from the AsyncResult::Pending
state to AsyncResult::Completed
with the provided result value.
If this async result handle has already been completed, Err
is returned with the passed value.
Sourcepub fn poll(&mut self) -> Self
pub fn poll(&mut self) -> Self
Polls the status of the async operation.
A AsyncResult::Completed
result transitions permanently to the AsyncResult::Consumed
state.
Auto Trait Implementations§
impl<T> Freeze for AsyncResult<T>where
T: Freeze,
impl<T> RefUnwindSafe for AsyncResult<T>where
T: RefUnwindSafe,
impl<T> Send for AsyncResult<T>where
T: Send,
impl<T> Sync for AsyncResult<T>where
T: Sync,
impl<T> Unpin for AsyncResult<T>where
T: Unpin,
impl<T> UnwindSafe for AsyncResult<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more