aboutsummaryrefslogtreecommitdiff
path: root/core/src/async_runtime/spawn.rs
blob: 2760982a6234d8fe3454aa8d3480215edbc127be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
use std::future::Future;

use super::Task;

pub fn spawn<T: Send + 'static>(future: impl Future<Output = T> + Send + 'static) -> Task<T> {
    #[cfg(feature = "smol")]
    let result: Task<T> = smol::spawn(future).into();
    #[cfg(feature = "tokio")]
    let result: Task<T> = tokio::spawn(future).into();

    result
}