#![deny(unsafe_op_in_unsafe_fn, missing_docs)]
mod task;
mod task_pool;
use futures_lite::future;
pub use task::*;
pub use task_pool::*;
use std::future::Future;
#[inline]
pub fn spawn<T>(future: impl Future<Output = T> + Send + 'static) -> Task<T>
where
T: Send + 'static,
{
TaskPool::global().spawn(future)
}
#[inline]
pub fn spawn_local<T>(future: impl Future<Output = T> + 'static) -> Task<T>
where
T: 'static,
{
TaskPool::global().spawn_local(future)
}
#[inline]
pub fn scope<'env, F, T>(f: F) -> Vec<T>
where
F: for<'scope> FnOnce(&'scope Scope<'scope, 'env, T>),
T: Send + 'static,
{
TaskPool::global().scope(f)
}
#[inline]
pub fn block_on<T>(future: impl Future<Output = T>) -> T {
future::block_on(future)
}