pub struct PendingResult<R> { /* private fields */ }Expand description
The pending result of async work.
Implementations§
Source§impl<R: Debug + Send + Sync + 'static> PendingResult<R>
impl<R: Debug + Send + Sync + 'static> PendingResult<R>
Sourcepub fn new(
receiver: impl ResultReceiver<Result = R> + Send + Sync + 'static,
) -> Self
pub fn new( receiver: impl ResultReceiver<Result = R> + Send + Sync + 'static, ) -> Self
Make a new pending result.
Sourcepub fn make_ready(result: R) -> Self
pub fn make_ready(result: R) -> Self
Make a pending result that is immediately ready.
Sourcepub fn has_result(&self) -> bool
pub fn has_result(&self) -> bool
Check if the result is available.
Sourcepub fn done(&self) -> bool
pub fn done(&self) -> bool
Check if work is done (the result may be unavailable if it was already extracted).
- This is robust for checking if a result-less task has completed (i.e.
PendingResult<()>).
Sourcepub fn try_extract(&mut self) -> Option<Result<R, ResultError>>
pub fn try_extract(&mut self) -> Option<Result<R, ResultError>>
Extract the result if available (non-blocking).
Returns None if the result is still pending.
Sourcepub async fn extract(&mut self) -> Result<R, ResultError>
pub async fn extract(&mut self) -> Result<R, ResultError>
Extract the result (async).
This method is not cancellation-safe.
Trait Implementations§
Auto Trait Implementations§
impl<R> Freeze for PendingResult<R>
impl<R> !RefUnwindSafe for PendingResult<R>
impl<R> Send for PendingResult<R>
impl<R> Sync for PendingResult<R>
impl<R> Unpin for PendingResult<R>
impl<R> !UnwindSafe for PendingResult<R>
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