1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// This file is part of the caducus crate.
// SPDX-FileCopyrightText: 2026 Zivatar Limited
// SPDX-License-Identifier: Apache-2.0
//! Bounded async MPSC/SPSC channel with item expiry.
//!
//! Caducus (latin) = perishable
//!
//! Caducus is a bounded asynchronous channel with two operating modes:
//! single-producer single-consumer ([`SpscBuilder`] / [`SpscSender`]) and
//! multi-producer single-consumer ([`MpscBuilder`] / [`MpscSender`]). Items
//! carry a time-to-live and are evicted when they expire; the eviction is
//! observable through user-supplied [`ReportChannel`]s.
//!
//! Use `shutdown()` on the sender side for controlled channel teardown. Dropping the last
//! sender also triggers a hard shutdown that drains and reports any items still in
//! the buffer.
//!
//! Caducus runs on Tokio. A runtime handle must be available either implicitly
//! (call `build()` from within a Tokio task) or explicitly via
//! [`SpscBuilder::runtime`] / [`MpscBuilder::runtime`].
//!
//! # Example
//!
//! ```no_run
//! use std::time::Duration;
//! use caducus::MpscBuilder;
//!
//! #[tokio::main]
//! async fn main() {
//! let (tx, rx) = MpscBuilder::<u32>::new(128, Duration::from_secs(5))
//! .build()
//! .expect("tokio runtime available");
//!
//! tx.send(42).expect("buffer not full");
//! let item = rx.next(None).await.expect("received before timeout");
//! assert_eq!(item, 42);
//! }
//! ```
/// Error types returned from every fallible operation in the public API.
/// Receive side of the channel. See [`Receiver`].
/// Send side of the channel. See [`SpscBuilder`], [`MpscBuilder`], [`SpscSender`],
/// and [`MpscSender`].
pub use crateReportChannel;
pub use ;
pub use Receiver;
pub use ;