pub trait OreFutureExt {
    // Required methods
    fn spawn_if_canceled<Name, NameClosure>(
        self,
        nc: NameClosure
    ) -> SpawnIfCanceled<Self::Output, Name, NameClosure> 
       where Name: AsRef<str>,
             NameClosure: FnOnce() -> Name + Unpin,
             Self: Future + Send + 'static,
             Self::Output: Send + 'static;
    fn run_in_task<'async_trait, Name, NameClosure>(
        self,
        nc: NameClosure
    ) -> Pin<Box<dyn Future<Output = Self::Output> + Send + 'async_trait>>
       where Name: AsRef<str> + 'async_trait,
             NameClosure: FnOnce() -> Name + Unpin + Send + 'async_trait,
             Self: Future + Send + 'static + 'async_trait,
             Self::Output: Send + 'static;
    fn ore_catch_unwind(self) -> OreCatchUnwind<Self> 
       where Self: Sized + UnwindSafe;
}
Available on crate feature async only.
Expand description

Extension methods for futures.

Required Methods§

source

fn spawn_if_canceled<Name, NameClosure>( self, nc: NameClosure ) -> SpawnIfCanceled<Self::Output, Name, NameClosure>
where Name: AsRef<str>, NameClosure: FnOnce() -> Name + Unpin, Self: Future + Send + 'static, Self::Output: Send + 'static,

Wraps a future in a SpawnIfCanceled future, which will spawn a task to poll the inner future to completion if it is dropped.

source

fn run_in_task<'async_trait, Name, NameClosure>( self, nc: NameClosure ) -> Pin<Box<dyn Future<Output = Self::Output> + Send + 'async_trait>>
where Name: AsRef<str> + 'async_trait, NameClosure: FnOnce() -> Name + Unpin + Send + 'async_trait, Self: Future + Send + 'static + 'async_trait, Self::Output: Send + 'static,

Run a 'static future in a Tokio task, naming that task, using a convenient postfix call notation.

source

fn ore_catch_unwind(self) -> OreCatchUnwind<Self>
where Self: Sized + UnwindSafe,

Like FutureExt::catch_unwind, but can unwind panics even if set_abort_on_panic has been called.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<T> OreFutureExt for T
where T: Future,