Skip to main content

join_with

Function join_with 

Source
pub fn join_with<P, A, B, RA, RB>(left: A, right: B) -> (RA, RB)
where P: ExecutionPolicy, A: FnOnce() -> RA + Send, B: FnOnce() -> RB, RA: Send,
Expand description

Run two closures to completion and return both results.

This is the synchronous Rayon-style join shape. The policy is selected at compile time; Sequential runs both closures on the caller, Parallel schedules the left closure on the unified scheduler and runs the right closure on the caller lane, and crate::Adaptive currently stays sequential for a fixed two-branch join.

A branch the scheduler refuses runs on the caller instead, so a shutting-down or saturated executor makes the join sequential rather than losing a branch.

§Panics

Panics if a branch panicked, propagating the failure on the caller’s thread as rayon does.