pub trait SpawnHandleExt<Out: 'static + Send>: SpawnHandle<Out> {
// Required method
fn spawn_handle(
&self,
future: impl Future<Output = Out> + Send + 'static,
) -> Result<JoinHandle<Out>, SpawnError>;
}
Expand description
Convenience trait for passing in a generic future to SpawnHandle
. Much akin to Spawn
and SpawnExt
in the
futures library.
Required Methods§
Sourcefn spawn_handle(
&self,
future: impl Future<Output = Out> + Send + 'static,
) -> Result<JoinHandle<Out>, SpawnError>
fn spawn_handle( &self, future: impl Future<Output = Out> + Send + 'static, ) -> Result<JoinHandle<Out>, SpawnError>
Spawn a future and return a JoinHandle that can be awaited for the output of the future.
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.