rings-runtime 1.0.0-pre.6

Shared native/browser runtime contracts (timers, task scheduling, thread-safety bounds) for Rings
Documentation
#![cfg_attr(
    test,
    allow(
        clippy::expect_used,
        clippy::indexing_slicing,
        clippy::panic,
        clippy::unwrap_used
    )
)]
#![doc = include_str!("../README.md")]

/// Apply the one cfg under which task scheduling exists: an executor is present — Tokio on
/// native (`tokio` feature) or the event loop in a browser.
macro_rules! with_executor {
    ($($item:item)*) => {
        $(
            #[cfg(any(feature = "tokio", all(feature = "browser", target_family = "wasm")))]
            $item
        )*
    };
}

mod bound;
#[cfg(all(feature = "browser", target_family = "wasm"))]
mod global;
mod timer;

with_executor! {
    mod task;
    mod task_set;

    #[cfg(not(all(feature = "browser", target_family = "wasm")))]
    pub use task::run_blocking;
    pub use task::run_detached;
    pub use task::spawn_detached;
    pub use task::Abandoned;
    pub use task::DetachedError;
    pub use task::RuntimeUnavailable;
    pub use task::Spawner;
    pub use task::Unscheduled;
    pub use task_set::Drained;
    pub use task_set::Joined;
    pub use task_set::TaskSet;
}

pub use bound::MaybeSend;
pub use bound::MaybeSendSync;
pub use timer::sleep;
pub use timer::TimerError;
pub use timer::UNBOUNDED_SLEEP;