graphrefly_operators/lib.rs
1//! Built-in operator node types for `GraphReFly`.
2//!
3//! Operators in this crate are specialized node types implemented
4//! directly against the Core protocol — they are not "user fns wrapped
5//! in nodes." A `map` operator's plumbing (dirty propagation, equals
6//! dedup, batch handling) runs entirely in Rust; only the user-supplied
7//! `(T) -> U` callback crosses the FFI boundary on each fire.
8//!
9//! # Status
10//!
11//! M3 complete: transform/combine/flow/higher-order/subscription/producer
12//! operators, cold sources, `stratify`, and napi parity (see
13//! `docs/migration-status.md`). Per-operator state uses
14//! [`OperatorScratch`](graphrefly_core::op_state::OperatorScratch) on
15//! `NodeRecord` (D026).
16//!
17//! # Module layout
18//!
19//! - [`transform`] — map, filter, scan, reduce, distinctUntilChanged,
20//! pairwise (✅ Slice C-1)
21//! - [`combine`] — combine, merge, withLatestFrom (✅ Slice C-2)
22//! - [`flow`] — take, skip, takeWhile, last + first/find/element_at
23//! sugar (✅ Slice C-3)
24//! - [`temporal`] — sample, debounce, throttle, delay, audit, interval,
25//! timeout, buffer_time, window_time
26//! (✅ Slice T)
27//! - `switching` — switchMap, mergeMap, concatMap
28//! - `gating` — valve, gate, budgetGate, policyGate
29//! - `resilience` — retry, circuitBreaker, timeout, fallback,
30//! rateLimiter, tokenBucket
31//!
32//! # Layering
33//!
34//! This crate depends on `graphrefly-core` only (per the user-direction
35//! constraint that operators do not depend on `graphrefly-graph`).
36//! Operator factories accept `&Core` directly. User callbacks travel
37//! through the [`OperatorBinding`] super-trait of `BindingBoundary`,
38//! which the binding crate (e.g., a `TestOperatorBinding` for tests, the
39//! napi-rs / pyo3 bindings in production) implements.
40
41#![forbid(unsafe_code)]
42#![warn(rust_2018_idioms, unreachable_pub)]
43#![warn(clippy::pedantic)]
44#![allow(
45 clippy::module_name_repetitions,
46 clippy::missing_errors_doc,
47 clippy::missing_panics_doc,
48 clippy::doc_markdown
49)]
50
51pub mod binding;
52pub mod buffer;
53pub mod combine;
54pub mod control;
55pub mod error;
56pub mod flow;
57pub mod higher_order;
58pub mod ops_impl;
59pub mod producer;
60pub mod source;
61pub mod stratify;
62pub mod temporal;
63pub mod transform;
64
65pub use binding::OperatorBinding;
66pub use buffer::{buffer, buffer_count, window, window_count};
67pub use combine::{combine as combine_latest, merge, with_latest_from, MergeRegistration};
68pub use control::{on_first_data, repeat, rescue, settle, tap, tap_observer, valve};
69pub use error::OperatorFactoryError;
70pub use flow::{
71 element_at, find, first, last, last_with_default, skip, take, take_while, FlowRegistration,
72};
73pub use higher_order::{
74 concat_map, exhaust_map, merge_map, merge_map_with_concurrency, switch_map, HigherOrderBinding,
75 ProjectFn,
76};
77pub use ops_impl::{concat, race, take_until, zip};
78pub use producer::{
79 default_producer_deactivate, MailboxEmitter, ProducerBinding, ProducerBuildFn, ProducerCtx,
80 ProducerEmitter, ProducerNodeState, ProducerStorage, SubscribeOutcome,
81};
82pub use source::{empty, from_iter, never, of, throw_error};
83pub use stratify::stratify_branch;
84pub use temporal::{
85 audit, buffer_time, debounce, delay, interval, sample, throttle, timeout, window_time,
86};
87pub use transform::{
88 distinct_until_changed, filter, map, pairwise, reduce, scan, OperatorRegistration,
89};