Sequence VecMerge
std/flow/u16::VecMerge
Inputs
⇥ a: Stream<Vec<u16>>
⇥ b: Stream<Vec<u16>>
⇥ order: Stream<bool>
Outputs
↦ value: Stream<Vec<u16>>
Merge two streams of Vec<u16>
.
The two streams are merged using the order
stream:
- when
true
, value froma
is used; - when
false
, value fromb
is used.
ℹ️ No value from either a
or b
are discarded, they are used when order
give turn.
⚠️ When order
ends merge terminates without treating the remaining values from a
and b
.
When order
give turn to a
or b
while the concerned stream is ended, the merge terminates.
Merge continues as long as order
and concerned stream does, while the other can be ended.
graph LR T("VecMerge()") A["… [🟦 🟦][🟫 🟫]…"] -->|a| T B["… [🟧 🟧 🟧][🟪][🟨 🟨]…"] -->|b| T O["… 🟩 🟥 🟥 🟩 🟥 …"] -->|order|T T -->|value| V["…[🟦 🟦][🟧 🟧 🟧][🟪][🟫 🟫][🟨 🟨]…"] style V fill:#ffff,stroke:#ffff style O fill:#ffff,stroke:#ffff style A fill:#ffff,stroke:#ffff style B fill:#ffff,stroke:#ffff