[][src]Trait async_executors::SpawnHandle

pub trait SpawnHandle {
    fn spawn_handle<Fut, Out>(
        &self,
        future: Fut
    ) -> Result<JoinHandle<Out>, SpawnError>
    where
        Fut: Future<Output = Out> + 'static + Send,
        Out: 'static + Send
; }
This is supported on feature="spawn_handle" only.

Let's you spawn and get a JoinHandle to await the output of a future.

This trait is not object safe, see SpawnHandleOs for a best effort object safe one.

Performance

For tokio and async-std this is generally faster than SpawnExt::spawn, since it's better aligned with the underlying API and doesn't require extra boxing.

Required methods

fn spawn_handle<Fut, Out>(
    &self,
    future: Fut
) -> Result<JoinHandle<Out>, SpawnError> where
    Fut: Future<Output = Out> + 'static + Send,
    Out: 'static + Send

This is supported on feature="spawn_handle" only.

Spawn a future and return a JoinHandle that can be awaited for the output of the future.

Loading content...

Implementations on Foreign Types

impl<T: SpawnHandle> SpawnHandle for Box<T>[src]

impl<T: SpawnHandle> SpawnHandle for Arc<T>[src]

impl<T: SpawnHandle> SpawnHandle for Rc<T>[src]

impl<'_, T: SpawnHandle> SpawnHandle for &'_ T[src]

impl<'_, T: SpawnHandle> SpawnHandle for &'_ mut T[src]

impl<T: SpawnHandle> SpawnHandle for Instrumented<T>[src]

impl<T: SpawnHandle> SpawnHandle for WithDispatch<T>[src]

impl SpawnHandle for LocalSpawner[src]

impl SpawnHandle for ThreadPool[src]

Loading content...

Implementors

impl SpawnHandle for AsyncStd[src]

impl SpawnHandle for Bindgen[src]

impl SpawnHandle for TokioCt[src]

impl SpawnHandle for TokioTp[src]

Loading content...