Skip to main content

OperatorOp

Enum OperatorOp 

Source
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).

Fields

§fn_id: FnId
§

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).

Fields

§fn_id: FnId
§

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.

Fields

§fn_id: FnId
§

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).

Fields

§fn_id: FnId
§

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).

Fields

§equals_fn_id: FnId
§

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.

Fields

§fn_id: FnId
§

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).

Fields

§pack_fn: FnId
§

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).

Fields

§pack_fn: FnId
§

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).

Fields

§count: u32
§

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).

Fields

§count: u32
§

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.

Fields

§fn_id: FnId
§

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.

Fields

§default: HandleId
§

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).

Fields

§fn_id: FnId
§

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.

Fields

§fn_id: FnId
§

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.

Fields

§quiet_waves: u32
§max_waves: Option<u32>

Trait Implementations§

Source§

impl Clone for OperatorOp

Source§

fn clone(&self) -> OperatorOp

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for OperatorOp

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for OperatorOp

Source§

fn eq(&self, other: &OperatorOp) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for OperatorOp

Source§

impl Eq for OperatorOp

Source§

impl StructuralPartialEq for OperatorOp

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.