use core::future::Future;
/// A spawner trait for spawning futures.
pub trait AsyncSpawner: Copy + Send + Sync + 'static {
/// The handle returned by the spawner when a future is spawned.
type JoinHandle<F>: Future + Send + Sync + 'static
where
F: Send + 'static;
/// Spawn a future.
fn spawn<F>(future: F) -> Self::JoinHandle<F::Output>
where
F::Output: Send + 'static,
F: Future + Send + 'static;
/// Spawn a future and detach it.
fn spawn_detach<F>(future: F)
where
F::Output: Send + 'static,
F: Future + Send + 'static,
{
core::mem::drop(Self::spawn(future));
}
}