Skip to main content

race

Function race 

Source
pub fn race(
    core: &Core,
    binding: &Arc<dyn ProducerBinding>,
    sources: Vec<NodeId>,
) -> Result<NodeId, OperatorFactoryError>
Expand description

race(s1, s2, ..., sN) — subscribes to all sources; the first to emit DATA wins. Subsequent traffic from the winner is forwarded; losers’ messages are no-ops (per Q4=(b) — losers stay subscribed but their sink callbacks short-circuit). Saves the dynamic rewiring cost of explicitly unsubscribing losers.

Empty source list completes immediately. Single source is identity-passthrough.

§Errors

Returns OperatorFactoryError::EmptySources when sources is empty (R5.7.x — race requires ≥1 source; no-winner-possible rejected).