Spawn

Trait Spawn 

Source
pub trait Spawn {
    type Future<T>: Future<Output = Result<T, Canceled>> + Send
       where T: Send;

    // Required method
    fn spawn_blocking<Func, Out>(&self, func: Func) -> Self::Future<Out>
       where Func: FnOnce() -> Out + Send + 'static,
             Out: Send + 'static;
}
Expand description

A trait dictating how to spawn a future onto a blocking threadpool. By default, http-signature-normalization-actix will use tokio’s built-in blocking threadpool, but this can be customized

Required Associated Types§

Source

type Future<T>: Future<Output = Result<T, Canceled>> + Send where T: Send

The future type returned by spawn_blocking

Required Methods§

Source

fn spawn_blocking<Func, Out>(&self, func: Func) -> Self::Future<Out>
where Func: FnOnce() -> Out + Send + 'static, Out: Send + 'static,

Spawn the blocking function onto the threadpool

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl Spawn for DefaultSpawner

Source§

type Future<T> = DefaultSpawnerFuture<T> where T: Send