simple-shutdown 0.1.0

Simple shutdown primitives for async runtimes
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
use core::future::Future;

pub trait Spawn {
    fn spawn(&self, future: impl Future<Output = ()> + Send + 'static);
}

#[cfg(feature = "tokio")]
impl Spawn for &tokio::runtime::Runtime {
    fn spawn(&self, future: impl Future<Output = ()> + Send + 'static) {
        tokio::runtime::Runtime::spawn(self, future);
    }
}