Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Treatment scatterGathering

std/flow/scatter::scatterGathering


Generics

◻ T (any)
◻ S (any)
◻ R (any)

Configuration

⬡ scatter: std/flow/scatter::Scatter

Parameters

↳ var parallel: u32 = 8

Inputs

⇥ shared: Block<S>
⇥ values: Stream<T>

Outputs

↦ completed: Block<void>
↦ errors: Stream<string>
↦ failed: Block<void>
↦ finished: Block<void>
↦ gathered: Stream<R>


Scatter values over tracks of their own, and gather their values.

As scatter does, with the values the tracks give to gatherValue coming through gathered, in the order the tracks end. A track gathering no value gives none, and values of another type than R are refused, the scatter failing.

graph LR
     T("scatterGathering()")
     V["… 🟦 🟦 🟦"] -->|values| T
     S["〈🟨〉"] -->|shared| T

     T -.->|"track per 🟦"| X["scattered() … gatherValue()"]
     T -->|gathered| G["… 🟪 🟪 🟪"]
     T -->|completed| C["〈🟩〉"]

     style V fill:#ffffff,stroke:#ffffff
     style S fill:#ffffff,stroke:#ffffff
     style X fill:#ffffff,stroke:#ffffff
     style G fill:#ffffff,stroke:#ffffff
     style C fill:#ffffff,stroke:#ffffff