go 0.1.2

A runtime-agnostic Go-style concurrency library for Rust
Documentation
use std::future::Future;
use std::time::Duration;

pub(crate) trait Backend {
    fn spawn<T: Send + 'static>(
        fut: impl Future<Output = T> + Send + 'static,
    ) -> crate::JoinHandle<T>;
    fn sleep(dur: Duration) -> impl Future<Output = ()> + Send;
}

#[cfg(feature = "rt-tokio")]
mod tokio_backend;
#[cfg(feature = "rt-tokio")]
pub(crate) type Active = tokio_backend::TokioBackend;

#[cfg(feature = "rt-async-std")]
mod async_std_backend;
#[cfg(feature = "rt-async-std")]
pub(crate) type Active = async_std_backend::AsyncStdBackend;

#[cfg(feature = "rt-smol")]
mod smol_backend;
#[cfg(feature = "rt-smol")]
pub(crate) type Active = smol_backend::SmolBackend;