pub enum OperatorOp {
Show 17 variants
Map {
fn_id: FnId,
},
Filter {
fn_id: FnId,
},
Scan {
fn_id: FnId,
seed: HandleId,
},
Reduce {
fn_id: FnId,
seed: HandleId,
},
DistinctUntilChanged {
equals_fn_id: FnId,
},
Pairwise {
fn_id: FnId,
},
Combine {
pack_fn: FnId,
},
WithLatestFrom {
pack_fn: FnId,
},
Merge,
Take {
count: u32,
},
Skip {
count: u32,
},
TakeWhile {
fn_id: FnId,
},
Last {
default: HandleId,
},
Tap {
fn_id: FnId,
},
TapFirst {
fn_id: FnId,
},
Valve,
Settle {
quiet_waves: u32,
max_waves: Option<u32>,
},
}Expand description
Built-in operator discriminant. Selects the per-operator dispatch path
in fire_operator (crates/graphrefly-core/src/batch.rs). Each variant
carries the binding-side closure ids (and seed handle for stateful
folders) needed for the wave-execution path; Core stores no user values
itself per the handle-protocol cleaving plane.
Variants§
Map
map(source, project) — element-wise transform. Calls
BindingBoundary::project_each(fn_id, &inputs) per fire; emits each
returned handle via commit_emission_verbatim (R1.3.2.d batch
semantics — no equals substitution between batch entries).
Filter
filter(source, predicate) — silent-drop selection (D012/D018).
Calls BindingBoundary::predicate_each(fn_id, &inputs); emits each
passing input verbatim. If zero pass on a wave that dirtied the
node, queues a single RESOLVED to settle (D018).
Scan
scan(source, fold, seed) — left-fold emitting each new accumulator.
seed is captured at registration; acc lives in
ScanState inside
[NodeRecord::op_scratch] and persists across waves until
resubscribable reset. Calls BindingBoundary::fold_each(fn_id, acc, &inputs) -> SmallVec<HandleId> per fire.
Reduce
reduce(source, fold, seed) — left-fold emitting once on upstream
COMPLETE. Accumulates silently while source DATA flows; on
dep[0].terminal == Some(Complete), emits [Data(acc), Complete].
On Error(h), propagates the error verbatim. Opts out of Lock 2.B
auto-cascade (see NodeKind::skips_auto_cascade).
DistinctUntilChanged
distinctUntilChanged(source, equals) — suppresses adjacent
duplicates. Calls BindingBoundary::custom_equals(equals_fn_id, prev, current) per input; emits non-equal items verbatim and
updates prev. If zero items pass on a wave that dirtied the node,
queues RESOLVED (matches Filter discipline).
Pairwise
pairwise(source) — emits (prev, current) pairs starting after
the second value. First value swallowed (sets prev). Calls
BindingBoundary::pairwise_pack(fn_id, prev, current) per pair to
produce the binding-side tuple handle.
Combine
combine(...sources) — N-dep combineLatest. On any dep fire, packs
the latest handle per dep into a single tuple handle via
BindingBoundary::pack_tuple(pack_fn, &handles). First-run gate
(partial: false default) holds until all deps deliver real DATA
(R2.5.3). COMPLETE cascades when all deps complete (R1.3.4.b).
WithLatestFrom
withLatestFrom(primary, secondary) — 2-dep, fire-on-primary-only
(D021, Phase 10.5). Packs [primary, secondary] via
BindingBoundary::pack_tuple(pack_fn, &handles) when dep[0]
(primary) has DATA in the wave. If only dep[1] (secondary) fires,
settles with RESOLVED (D018 pattern). First-run gate holds until
both deps deliver (R2.5.3 partial: false). Post-warmup INVALIDATE
guard: if secondary prev_data == NO_HANDLE and batch empty after
warmup, settles with RESOLVED (no stale pair).
Merge
merge(...sources) — N-dep, forward all DATA handles verbatim
(D022). Zero FFI on fire: no transformation, no binding call.
Each dep’s batch handles are retained and emitted individually.
COMPLETE cascades when all deps complete (R1.3.4.b).
Take
take(source, count) — emits the first count DATA values then
self-completes via Core::complete. Tracks count_emitted in
TakeState. When upstream completes
before count is reached, the standard auto-cascade propagates
COMPLETE. count == 0 is allowed: the first fire emits zero
items then immediately self-completes (D027).
Skip
skip(source, count) — drops the first count DATA values; once
the threshold is crossed, subsequent DATAs pass through verbatim.
Tracks count_skipped in SkipState.
On a wave where every input is still in the skip window, queues
DIRTY+RESOLVED to settle (D018 pattern).
TakeWhile
takeWhile(source, predicate) — emits while predicate(input)
holds; on the first false, emits any preceding passes then
self-completes via Core::complete. Reuses
BindingBoundary::predicate_each (D029); after the first
false, subsequent inputs in the same batch are dropped.
Last
last(source) / last_with_default(source, default) — buffers
the latest DATA; on upstream COMPLETE, emits Data(latest) then
Complete. The default field is NO_HANDLE for the no-default
factory (emits only Complete on empty stream), or a registered
default handle (emits Data(default) + Complete on empty
stream). Storage: LastState holds
latest (live buffer) and default (registration-time, stable).
Opts out of Lock 2.B auto-cascade so it can intercept upstream
COMPLETE.
Tap
tap(source, fn) — side-effect passthrough. Calls
BindingBoundary::invoke_tap_fn(fn_id, handle) on each input DATA,
then emits the input handle unchanged. Zero-transform: output
handles are the inputs verbatim (no equals substitution, no
allocation).
TapFirst
tapFirst(source, fn) — one-shot side-effect on first DATA. Same
as Tap but fires invoke_tap_fn only once; after
the first fire, subsequent DATA passes through without a callback.
State: TapFirstState tracks
fired: bool.
Valve
valve(source, control) — conditional forward. 2-dep: dep[0] is
source, dep[1] is boolean control. When the latest control value
is truthy (non-zero handle), forwards source DATA; when falsy,
settles with RESOLVED. Partial mode so it fires on control-alone
before source has delivered. Does NOT auto-complete on control
terminal (completeWhenDepsComplete: false equivalent).
Settle
settle(source, quietWaves, maxWaves) — convergence detector.
Forwards each upstream DATA, counts consecutive no-change waves,
and self-completes when quiet_count >= quiet_waves (or
wave_count >= max_waves if set). State:
SettleState.
Trait Implementations§
Source§impl Clone for OperatorOp
impl Clone for OperatorOp
Source§fn clone(&self) -> OperatorOp
fn clone(&self) -> OperatorOp
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for OperatorOp
impl Debug for OperatorOp
Source§impl PartialEq for OperatorOp
impl PartialEq for OperatorOp
Source§fn eq(&self, other: &OperatorOp) -> bool
fn eq(&self, other: &OperatorOp) -> bool
self and other values to be equal, and is used by ==.impl Copy for OperatorOp
impl Eq for OperatorOp
impl StructuralPartialEq for OperatorOp
Auto Trait Implementations§
impl Freeze for OperatorOp
impl RefUnwindSafe for OperatorOp
impl Send for OperatorOp
impl Sync for OperatorOp
impl Unpin for OperatorOp
impl UnsafeUnpin for OperatorOp
impl UnwindSafe for OperatorOp
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.