[][src]Trait async_spawner::Executor

pub trait Executor: Send + Sync {
    pub fn block_on(
        &self,
        future: Pin<Box<dyn Future<Output = ()> + Send + 'static>>
    );
pub fn spawn(
        &self,
        future: Pin<Box<dyn Future<Output = ()> + Send + 'static>>
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'static>>;
pub fn spawn_blocking(
        &self,
        task: Box<dyn FnOnce() + Send>
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'static>>;
pub fn spawn_local(
        &self,
        future: Pin<Box<dyn Future<Output = ()> + 'static>>
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'static>>; }

Trait abstracting over an executor.

Required methods

pub fn block_on(
    &self,
    future: Pin<Box<dyn Future<Output = ()> + Send + 'static>>
)
[src]

Blocks until the future has finished.

pub fn spawn(
    &self,
    future: Pin<Box<dyn Future<Output = ()> + Send + 'static>>
) -> Pin<Box<dyn Future<Output = ()> + Send + 'static>>
[src]

Spawns an asynchronous task using the underlying executor.

pub fn spawn_blocking(
    &self,
    task: Box<dyn FnOnce() + Send>
) -> Pin<Box<dyn Future<Output = ()> + Send + 'static>>
[src]

Runs the provided closure on a thread, which can execute blocking tasks asynchronously.

pub fn spawn_local(
    &self,
    future: Pin<Box<dyn Future<Output = ()> + 'static>>
) -> Pin<Box<dyn Future<Output = ()> + Send + 'static>>
[src]

Spawns a future that doesn't implement Send.

The spawned future will be executed on the same thread that called spawn_local.

Loading content...

Implementors

Loading content...