Skip to main content

ferroui_reactive/
lib.rs

1//! ferroui-reactive
2//!
3//! A port of Rx.NET's System.Reactive (<https://github.com/dotnet/reactive>) to Rust: observable
4//! sequences, their operators, the schedulers that decide when work runs, the disposables that end
5//! subscriptions, and subjects. It depends on nothing of the user interface of FerroUI; the
6//! interfaces it implements (`IObservable<T>`, `IObserver<T>`, `IDisposable`) are those of
7//! `ferroui-system`, which the framework uses too, so the sequences of this crate bind to the
8//! properties of controls as they are.
9//!
10//! The modules follow the namespaces of System.Reactive:
11//!
12//! - [`concurrency`]: `System.Reactive.Concurrency` (schedulers).
13//! - [`disposables`]: `System.Reactive.Disposables`.
14//! - [`subjects`]: `System.Reactive.Subjects`.
15//! - [`linq`]: `System.Reactive.Linq` (the operators: [`Observable`] and [`ObservableExt`]).
16//! - The root: `Notification<T>`, `Unit`, `TimeInterval<T>`, `Timestamped<T>`, the observers
17//!   (`Observer`, `AnonymousObserver<T>`, `ObserverBase<T>`), `ObservableBase<T>`.
18//!
19//! Everything is single-threaded and reference counted, as the object model of FerroUI is: a
20//! sequence and its subscriptions live on the thread that created them, and the schedulers of the
21//! crate run their work on that thread (`docs/porting/reactive.md`, section 5.1).
22
23pub mod concurrency;
24pub mod disposables;
25// The machinery of the operators; parts of it are used by the operator families as they are ported.
26#[allow(unused_imports, dead_code)]
27pub(crate) mod internal;
28pub mod linq;
29mod notification;
30mod observable_base;
31mod observer;
32mod observer_base;
33pub mod subjects;
34mod time_interval;
35
36pub use ferroui_system::{IDisposable, IObservable, IObserver, ObservableError};
37pub use linq::{ConnectableObservableExt, Observable, ObservableExt, TaskObservableExt};
38pub use notification::{IObserverWithResult, Notification, NotificationKind};
39pub use observable_base::{ObservableBase, ObservableCore};
40pub use observer::{AnonymousObserver, Observer, ObserverExt, ProgressExt};
41pub use observer_base::{ObserverBase, ObserverCore};
42pub use time_interval::{TimeInterval, Timestamped};
43
44/// The type of a notification without a value (`System.Reactive.Unit`): Rust's unit type.
45pub type Unit = ();
46
47#[cfg(test)]
48mod tests;