Skip to main content

rskit_stream/
lib.rs

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