rskit_stream/lib.rs
1//! Foundational async stream toolkit.
2//!
3//! `rskit-stream` owns the opinion-free, layer-zero building blocks for the
4//! "observe → fan-out → consume" graph that recurs across config reloads,
5//! service discovery, cache invalidation, secret rotation, and message
6//! consumers. Sources, the bounded fan-out bus, cancellable consumer tasks,
7//! and the `futures::Stream` extension operators that chain them all live
8//! together at the foundation where any higher layer can reuse them without
9//! inverting the layer order.
10//!
11//! Sequential, named-step workflows (run N steps, report progress, cancel)
12//! are a different concern and live in `rskit-chain`.
13
14#![warn(missing_docs)]
15
16/// Bounded fan-out broadcaster source (`Broadcaster<T>`).
17pub mod broadcaster;
18/// Extension trait adding `rskit` operators to any `Stream`.
19pub mod ext;
20/// Higher-level stream operators (map, filter, fan-out, windowing, etc.).
21pub mod operators;
22/// Terminal sink combinators (`collect`, `drain`, `for_each`).
23pub mod sink;
24/// Stream source constructors (`from_slice`, `from_fn`, `from_channel`).
25pub mod source;
26/// Cancellable owned tasks (`SpawnedTask`, `TaskGroup`).
27pub mod task;
28
29pub use broadcaster::{BroadcastStream, Broadcaster, DEFAULT_BROADCAST_BUFFER};
30pub use ext::RskitStreamExt;
31pub use operators::combine::{concat, merge};
32pub use sink::{collect, drain, for_each};
33pub use source::{from_channel, from_fn, from_slice};
34pub use task::{SpawnedTask, TaskGroup};
35
36pub use tokio_util::sync::CancellationToken;
37
38#[cfg(test)]
39mod tests;