[−][src]Trait async_executors::SpawnHandle
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,
&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.
Implementations on Foreign Types
impl<T: SpawnHandle> SpawnHandle for Box<T>
[src]
fn spawn_handle<Fut, Out>(
&self,
future: Fut
) -> Result<JoinHandle<Out>, SpawnError> where
Fut: Future<Output = Out> + 'static + Send,
Out: 'static + Send,
[src]
&self,
future: Fut
) -> Result<JoinHandle<Out>, SpawnError> where
Fut: Future<Output = Out> + 'static + Send,
Out: 'static + Send,
impl<T: SpawnHandle> SpawnHandle for Arc<T>
[src]
fn spawn_handle<Fut, Out>(
&self,
future: Fut
) -> Result<JoinHandle<Out>, SpawnError> where
Fut: Future<Output = Out> + 'static + Send,
Out: 'static + Send,
[src]
&self,
future: Fut
) -> Result<JoinHandle<Out>, SpawnError> where
Fut: Future<Output = Out> + 'static + Send,
Out: 'static + Send,
impl<T: SpawnHandle> SpawnHandle for Rc<T>
[src]
fn spawn_handle<Fut, Out>(
&self,
future: Fut
) -> Result<JoinHandle<Out>, SpawnError> where
Fut: Future<Output = Out> + 'static + Send,
Out: 'static + Send,
[src]
&self,
future: Fut
) -> Result<JoinHandle<Out>, SpawnError> where
Fut: Future<Output = Out> + 'static + Send,
Out: 'static + Send,
impl<'_, T: SpawnHandle> SpawnHandle for &'_ T
[src]
fn spawn_handle<Fut, Out>(
&self,
future: Fut
) -> Result<JoinHandle<Out>, SpawnError> where
Fut: Future<Output = Out> + 'static + Send,
Out: 'static + Send,
[src]
&self,
future: Fut
) -> Result<JoinHandle<Out>, SpawnError> where
Fut: Future<Output = Out> + 'static + Send,
Out: 'static + Send,
impl<'_, T: SpawnHandle> SpawnHandle for &'_ mut T
[src]
fn spawn_handle<Fut, Out>(
&self,
future: Fut
) -> Result<JoinHandle<Out>, SpawnError> where
Fut: Future<Output = Out> + 'static + Send,
Out: 'static + Send,
[src]
&self,
future: Fut
) -> Result<JoinHandle<Out>, SpawnError> where
Fut: Future<Output = Out> + 'static + Send,
Out: 'static + Send,
impl<T: SpawnHandle> SpawnHandle for Instrumented<T>
[src]
fn spawn_handle<Fut, Out>(
&self,
future: Fut
) -> Result<JoinHandle<Out>, SpawnError> where
Fut: Future<Output = Out> + 'static + Send,
Out: 'static + Send,
[src]
&self,
future: Fut
) -> Result<JoinHandle<Out>, SpawnError> where
Fut: Future<Output = Out> + 'static + Send,
Out: 'static + Send,
impl<T: SpawnHandle> SpawnHandle for WithDispatch<T>
[src]
fn spawn_handle<Fut, Out>(
&self,
future: Fut
) -> Result<JoinHandle<Out>, SpawnError> where
Fut: Future<Output = Out> + 'static + Send,
Out: 'static + Send,
[src]
&self,
future: Fut
) -> Result<JoinHandle<Out>, SpawnError> where
Fut: Future<Output = Out> + 'static + Send,
Out: 'static + Send,
impl SpawnHandle for LocalSpawner
[src]
fn spawn_handle<Fut, Out>(
&self,
future: Fut
) -> Result<JoinHandle<Out>, SpawnError> where
Fut: Future<Output = Out> + 'static + Send,
Out: 'static + Send,
[src]
&self,
future: Fut
) -> Result<JoinHandle<Out>, SpawnError> where
Fut: Future<Output = Out> + 'static + Send,
Out: 'static + Send,
impl SpawnHandle for ThreadPool
[src]
fn spawn_handle<Fut, Out>(
&self,
future: Fut
) -> Result<JoinHandle<Out>, SpawnError> where
Fut: Future<Output = Out> + 'static + Send,
Out: 'static + Send,
[src]
&self,
future: Fut
) -> Result<JoinHandle<Out>, SpawnError> where
Fut: Future<Output = Out> + 'static + Send,
Out: 'static + Send,
Implementors
impl SpawnHandle for AsyncStd
[src]
fn spawn_handle<Fut, Out>(
&self,
future: Fut
) -> Result<JoinHandle<Out>, SpawnError> where
Fut: Future<Output = Out> + 'static + Send,
Out: 'static + Send,
[src]
&self,
future: Fut
) -> Result<JoinHandle<Out>, SpawnError> where
Fut: Future<Output = Out> + 'static + Send,
Out: 'static + Send,
impl SpawnHandle for Bindgen
[src]
fn spawn_handle<Fut, Out>(
&self,
future: Fut
) -> Result<JoinHandle<Out>, SpawnError> where
Fut: Future<Output = Out> + 'static + Send,
Out: 'static + Send,
[src]
&self,
future: Fut
) -> Result<JoinHandle<Out>, SpawnError> where
Fut: Future<Output = Out> + 'static + Send,
Out: 'static + Send,
impl SpawnHandle for TokioCt
[src]
fn spawn_handle<Fut, Out>(
&self,
future: Fut
) -> Result<JoinHandle<Out>, SpawnError> where
Fut: Future<Output = Out> + 'static + Send,
Out: 'static + Send,
[src]
&self,
future: Fut
) -> Result<JoinHandle<Out>, SpawnError> where
Fut: Future<Output = Out> + 'static + Send,
Out: 'static + Send,
impl SpawnHandle for TokioTp
[src]
fn spawn_handle<Fut, Out>(
&self,
future: Fut
) -> Result<JoinHandle<Out>, SpawnError> where
Fut: Future<Output = Out> + 'static + Send,
Out: 'static + Send,
[src]
&self,
future: Fut
) -> Result<JoinHandle<Out>, SpawnError> where
Fut: Future<Output = Out> + 'static + Send,
Out: 'static + Send,