pub enum FnResult {
Data {
handle: HandleId,
tracked: Option<Vec<usize>>,
},
Noop {
tracked: Option<Vec<usize>>,
},
Batch {
emissions: SmallVec<[FnEmission; 2]>,
tracked: Option<Vec<usize>>,
},
}Expand description
What the binding side returns when the Core invokes a fn via
BindingBoundary::invoke_fn.
Models the three emission modes from the canonical spec:
FnResult::Data— single DATA, equals substitution applies (R1.3.2). Maps toactions.emit(v)in sugar constructors.FnResult::Batch— multi-message wave, no equals substitution (R1.3.2.d / R1.3.3.c). Maps toactions.down(msgs).FnResult::Noop— no emission. RESOLVED if node was DIRTY.
Per R2.4.5, the fn return value in the canonical spec is cleanup hooks
only — all emission is explicit via actions. The Rust Core folds the
emission into FnResult as a pragmatic simplification; the binding
layer maps between the two representations.
Variants§
Data
fn produced a single value. The Core treats this as outgoing DATA — equals-substitution against the cache may rewrite it to RESOLVED on the wire (R1.3.2).
Fields
Noop
fn ran but produced no emission this wave. The Core sends RESOLVED to subscribers if the node was already DIRTY this wave; otherwise no outgoing message.
Batch
Multi-message wave — models actions.down(msgs). Emissions are
processed in sequence within the same wave. No equals substitution
on any Data emission (R1.3.2.d: substitution only on single-DATA
waves; R1.3.3.c: multi-DATA passes verbatim). DIRTY auto-prefix
only on first Data per R1.3.1.a.