Trait completion::future::CompletionFutureExt [−][src]
Extension trait for CompletionFuture
.
Provided methods
unsafe fn poll(&mut self, cx: &mut Context<'_>) -> Poll<Self::Output> where
Self: Unpin,
[src]
Self: Unpin,
A convenience for calling CompletionFuture::poll
on Unpin
futures.
Safety
Identical to CompletionFuture::poll
.
unsafe fn poll_cancel(&mut self, cx: &mut Context<'_>) -> Poll<()> where
Self: Unpin,
[src]
Self: Unpin,
A convenience for calling CompletionFuture::poll_cancel
on Unpin
futures.
Safety
Identical to CompletionFuture::poll_cancel
.
fn must_complete(self) -> MustComplete<Self> where
Self: Sized,
[src]
Self: Sized,
Make sure that the future will complete. Any requests to cancel the future through
poll_cancel
will be ignored.
fn now_or_never(self) -> NowOrNever<Self>ⓘNotable traits for NowOrNever<F>
impl<F> Future for NowOrNever<F> where
F: CompletionFuture + Future<Output = <F as CompletionFuture>::Output>, type Output = Option<<F as CompletionFuture>::Output>;
where
Self: Sized,
[src]
Notable traits for NowOrNever<F>
impl<F> Future for NowOrNever<F> where
F: CompletionFuture + Future<Output = <F as CompletionFuture>::Output>, type Output = Option<<F as CompletionFuture>::Output>;
Self: Sized,
Get the future’s output if it’s ready, or cancel it if it’s not.
Examples
use completion::{future, CompletionFutureExt}; assert_eq!(future::ready(5).now_or_never().await, Some(5)); assert_eq!(future::pending::<()>().now_or_never().await, None);
fn catch_unwind(self) -> CatchUnwind<Self>ⓘNotable traits for CatchUnwind<F>
impl<F: Future + UnwindSafe + ?Sized> Future for CatchUnwind<F> type Output = Result<F::Output, Box<dyn Any + Send>>;
where
Self: Sized + UnwindSafe,
[src]
Notable traits for CatchUnwind<F>
impl<F: Future + UnwindSafe + ?Sized> Future for CatchUnwind<F> type Output = Result<F::Output, Box<dyn Any + Send>>;
Self: Sized + UnwindSafe,
This is supported on crate feature
std
only.Catch panics in the future.
Examples
use completion::{CompletionFutureExt, completion_async}; let future = completion_async!(panic!()); assert!(future.catch_unwind().await.is_err());
fn boxed<'a>(self) -> BoxCompletionFuture<'a, Self::Output> where
Self: Sized + Send + 'a,
[src]
Self: Sized + Send + 'a,
This is supported on crate feature
alloc
only.Box the future, erasing its type.
Examples
use completion::{CompletionFutureExt, completion_async}; // These futures are different types, but boxing them makes them the same type. let fut = if some_condition { completion_async!(5).boxed() } else { completion_async!(6).boxed() };
fn boxed_local<'a>(self) -> LocalBoxCompletionFuture<'a, Self::Output> where
Self: Sized + 'a,
[src]
Self: Sized + 'a,
This is supported on crate feature
alloc
only.Box the future locally, erasing its type.
Examples
use completion::{CompletionFutureExt, completion_async}; // These futures are different types, but boxing them makes them the same type. let fut = if some_condition { completion_async!(5).boxed_local() } else { completion_async!(6).boxed_local() };