roam-session 0.6.0

Session/state machine (handshake, request_id/channel_id routing, flow control)
Documentation
//! Runtime abstraction layer for tokio/WASM portability.
//!
//! This module provides abstractions over async runtime primitives so the same
//! code can run on both tokio (native) and WASM runtimes.
//!
//! # Supported Primitives
//!
//! | Tokio              | WASM Equivalent              |
//! |--------------------|------------------------------|
//! | `tokio::spawn`     | `wasm_bindgen_futures::spawn_local` |
//! | `tokio::sync::mpsc`| `futures_channel::mpsc`      |
//! | `tokio::sync::oneshot` | `futures_channel::oneshot` |
//! | `tokio::time::timeout` | Manual with gloo-timers  |
//! | `tokio::time::sleep` | `gloo_timers::future::sleep` |
//! | `tokio::sync::Mutex` | `futures_util::lock::Mutex`  |
//!
//! # Usage
//!
//! ```ignore
//! use roam_session::runtime;
//!
//! // Spawn a task
//! runtime::spawn(async { /* ... */ });
//!
//! // Create channels
//! let (tx, rx) = runtime::channel(16);
//! let (otx, orx) = runtime::oneshot();
//!
//! // Timeouts and sleeping
//! runtime::sleep(Duration::from_secs(1)).await;
//! let result = runtime::timeout(Duration::from_secs(5), some_future).await;
//! ```

#[cfg(not(target_arch = "wasm32"))]
mod tokio_runtime;
#[cfg(not(target_arch = "wasm32"))]
pub use tokio_runtime::*;

#[cfg(target_arch = "wasm32")]
mod wasm;
#[cfg(target_arch = "wasm32")]
pub use wasm::*;