Skip to main content

stratify_branch

Function stratify_branch 

Source
pub fn stratify_branch(
    core: &Core,
    binding: &Arc<dyn ProducerBinding>,
    source: NodeId,
    rules: NodeId,
    classifier_fn_id: FnId,
) -> NodeId
Expand description

Single classifier-routing branch. Each rule in a TS stratify(...) -> Graph becomes one instance of this operator.

classifier_fn_id is a binding-registered closure of shape (rules_handle, value_handle) -> bool. The binding-side closure dereferences rules_handle to the latest rules array, looks up the branch’s rule by name (captured in the closure), and runs the rule’s classify(value) predicate. Returning false for “rule not found” or “classifier threw” matches TS semantics.

§Returns

The produced node’s NodeId. The node emits DATA only for values whose classifier returned true after BOTH source and rules have settled in the same wave.