[][src]Trait completion::future::CompletionFutureExt

pub trait CompletionFutureExt: CompletionFuture {
    pub unsafe fn poll(&mut self, cx: &mut Context<'_>) -> Poll<Self::Output>
    where
        Self: Unpin
, { ... }
pub 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
, { ... }
pub fn boxed<'a>(self) -> BoxCompletionFuture<'a, Self::Output>
    where
        Self: Sized + Send + 'a
, { ... }
pub fn boxed_local<'a>(self) -> LocalBoxCompletionFuture<'a, Self::Output>
    where
        Self: Sized + 'a
, { ... } }

Extension trait for CompletionFuture.

Provided methods

pub unsafe fn poll(&mut self, cx: &mut Context<'_>) -> Poll<Self::Output> where
    Self: Unpin
[src]

A convenience for calling CompletionFuture::poll on Unpin futures.

Safety

Identical to CompletionFuture::poll.

pub 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]

Catch panics in the future.

Requires the std feature.

Examples

use completion::{CompletionFutureExt, completion_async};

let future = completion_async!(panic!());
assert!(future.catch_unwind().await.is_err());

pub fn boxed<'a>(self) -> BoxCompletionFuture<'a, Self::Output> where
    Self: Sized + Send + 'a, 
[src]

Box the future, erasing its type.

Requires the alloc feature.

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()
};

pub fn boxed_local<'a>(self) -> LocalBoxCompletionFuture<'a, Self::Output> where
    Self: Sized + 'a, 
[src]

Box the future locally, erasing its type.

Requires the alloc feature.

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()
};
Loading content...

Implementors

impl<T: CompletionFuture + ?Sized> CompletionFutureExt for T[src]

Loading content...