fanring 0.3.9

High-throughput typed MPSC and MPMC channels with per-producer backpressure
Documentation
#![deny(missing_docs)]

//! Fast typed in-process MPSC and MPMC channels built from SPSC rings.
//!
//! Every sender owns one bounded ring. Producers therefore avoid contention on
//! a shared queue tail, while receiver-side batching amortizes synchronization.
//! Sender registration is dynamic and dropped lane slots are reused.
//!
//! # Choose a channel
//!
//! - [`mpsc`] has one receiver, preserves FIFO within each sender lane, and has
//!   the smallest receive-side overhead.
//! - [`mpmc`] has cloneable competing receivers and relaxed ordering. Receivers
//!   stage batches in bounded queues that other receivers can steal.
//!
//! Both variants provide nonblocking, blocking, timeout, and deadline APIs.
//! Capacity is a high-water mark per sender, not one shared channel bound.
//!
//! # Teardown
//!
//! Constructors default to [`teardown::Deferred`]: unread ring payloads may
//! remain alive until their sender drops. Choose [`teardown::Coordinated`] with
//! [`mpsc::channel_with_policy`] or [`mpmc::channel_with_policy`] to reclaim
//! payloads independently of idle sender lifetimes. An overlapping send can
//! finish cleanup after receiver drop returns, without blocking that drop on a
//! paused producer. The choice is per channel and inherited by cloned handles.
//!
//! # Example
//!
//! ```
//! use fanring::mpsc;
//!
//! let (mut tx0, mut rx) = mpsc::channel(64);
//! let mut tx1 = tx0.try_clone().expect("receiver is alive");
//!
//! tx0.send("first").unwrap();
//! tx1.send("second").unwrap();
//!
//! let mut values = [rx.recv().unwrap(), rx.recv().unwrap()];
//! values.sort_unstable();
//! assert_eq!(values, ["first", "second"]);
//! ```
//!
//! See each channel module for its exact ordering, capacity, and disconnection
//! contracts.

mod compat;
mod config;
mod error;
pub mod mpmc;
pub mod mpsc;
mod publication;
mod ready;
mod ring;
pub mod teardown;
mod wait;

pub use config::WaitStrategy;