use crate::runtime::RuntimeHandle; use std::future::Future; pub mod sync { pub use jitterbug::{AbortHandle, JoinError, JoinHandle}; } pub mod unsync { pub use bachata::{JoinError, JoinHandle}; } pub fn spawn( future: impl Future + Send + 'static, ) -> sync::JoinHandle { RuntimeHandle::current().spawn(future) } pub fn spawn_local_unsend(future: impl Future + 'static) -> unsync::JoinHandle { RuntimeHandle::current().spawn_local_unsend(future) } pub fn spawn_local( future: impl Future + 'static, ) -> sync::JoinHandle { RuntimeHandle::current().spawn_local(future) } pub fn spawn_blocking( callback: impl FnOnce() -> T + Send + 'static, ) -> sync::JoinHandle { RuntimeHandle::current().spawn_blocking(callback) }