moire_tokio/disabled/task/
mod.rs1pub use join_handle::JoinHandle;
2pub use joinset::JoinSet;
3
4pub mod join_handle;
5pub mod joinset;
6
7use std::future::IntoFuture;
8
9pub trait FutureExt: IntoFuture + Sized {
11 fn named(self, _name: impl Into<String>) -> Self {
12 self
13 }
14}
15
16impl<F: IntoFuture + Sized> FutureExt for F {}
17
18pub fn spawn<T, F>(future: F) -> JoinHandle<T>
20where
21 T: Send + 'static,
22 F: Future<Output = T> + Send + 'static,
23{
24 JoinHandle(tokio::task::spawn(future))
25}
26
27pub fn spawn_blocking<T, F>(f: F) -> JoinHandle<T>
29where
30 T: Send + 'static,
31 F: FnOnce() -> T + Send + 'static,
32{
33 JoinHandle(tokio::task::spawn_blocking(f))
34}