spawn-std-core 0.1.0-alpha.1

Helper traits for spawning asynchronous tasks while letting the user choose the runtime.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
pub trait Executor {
    type Handle<T: Send + 'static>: Handle<T>;

    fn spawn<T, F>(future: F) -> Self::Handle<T>
    where
        T: Send + 'static,
        F: Future<Output = T> + Send + 'static;
}

pub trait Handle<T>: Future<Output = Result<T, Self::Error>> {
    type Error: std::fmt::Debug;

    fn abort(self);
}