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
59
60
61
62
63
64
65
66
67
68
69
70
71
// Copyright 2025 Umberto Gotti <umberto.gotti@umbertogotti.dev>
// Licensed under the Apache License, Version 2.0
// http://www.apache.org/licenses/LICENSE-2.0
//! Hot, multi-subscriber subject for Fluxion streams.
//!
//! A [`FluxionSubject`] broadcasts each [`StreamItem<T>`](crate::StreamItem) to all active subscribers.
//!
//! ## Characteristics
//!
//! - **Hot**: Late subscribers do not receive past items—only items sent after subscribing.
//! - **Unbounded**: Uses unbounded mpsc channels internally (no backpressure).
//! - **Thread-safe**: Cheap to clone; all clones share the same internal state.
//! - **std-only**: Requires the `std` feature (uses `parking_lot::Mutex`).
//! - **Error/close**: Errors are propagated to all subscribers and terminate the subject.
//!
//! ## Example
//!
//! ```
//! use fluxion_core::{FluxionSubject, StreamItem};
//! use futures::StreamExt;
//!
//! # #[tokio::main]
//! # async fn main() {
//! let subject = FluxionSubject::<i32>::new();
//!
//! // Subscribe before sending
//! let mut stream = subject.subscribe().unwrap();
//!
//! // Send values to all subscribers
//! subject.send(StreamItem::Value(1)).unwrap();
//! subject.send(StreamItem::Value(2)).unwrap();
//! subject.close();
//!
//! // Receive values
//! assert_eq!(stream.next().await, Some(StreamItem::Value(1)));
//! assert_eq!(stream.next().await, Some(StreamItem::Value(2)));
//! assert_eq!(stream.next().await, None); // Subject closed
//! # }
//! ```
pub use FluxionSubject;
pub use FluxionSubject;