Executor

Trait Executor 

Source
pub trait Executor {
    type JoinHandle<T: 'static>;

    // Required method
    fn spawn<F>(&self, future: F) -> Self::JoinHandle<<F as Future>::Output>
       where F: Future + Send + 'static,
             <F as Future>::Output: Send + 'static;
}
Expand description

An executor which futures can be spawned on.

Required Associated Types§

Source

type JoinHandle<T: 'static>

A join handle which completes with the output of a future.

JoinHandles have detach-on-drop semantics.

Required Methods§

Source

fn spawn<F>(&self, future: F) -> Self::JoinHandle<<F as Future>::Output>
where F: Future + Send + 'static, <F as Future>::Output: Send + 'static,

Spawns the given future on this executor, returning a JoinHandle for the task.

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.

Implementations on Foreign Types§

Source§

impl Executor for Scope

Source§

type JoinHandle<T: 'static> = CancelableJoinHandle<T>

Source§

fn spawn<F>( &self, future: F, ) -> <Scope as Executor>::JoinHandle<<F as Future>::Output>
where F: Future + Send + 'static, <F as Future>::Output: Send + 'static,

Source§

impl Executor for ScopeHandle

Source§

type JoinHandle<T: 'static> = CancelableJoinHandle<T>

Source§

fn spawn<F>( &self, future: F, ) -> <ScopeHandle as Executor>::JoinHandle<<F as Future>::Output>
where F: Future + Send + 'static, <F as Future>::Output: Send + 'static,

Implementors§

Source§

impl Executor for FuchsiaAsync

Source§

type JoinHandle<T: 'static> = CancelableJoinHandle<T>