Treatment merge

flow/vec/i64::merge


Inputs

⇥ a: Stream<Vec<i64>>
⇥ b: Stream<Vec<i64>>
⇥ select: Stream<bool>

Outputs

↦ value: Stream<Vec<i64>>


Merge two streams of Vec<i64>.

The two streams are merged using the select stream:

  • when true, vector from a is used;
  • when false, vector from b is used.

ℹ️ No vector from either a or b are discarded, they are used when select give turn.

⚠️ When select ends merge terminates without treating the remaining vectors from a and b. When select give turn to a or b while the concerned stream is ended, the merge terminates. Merge continues as long as select and concerned stream does, while the other can be ended.

graph LR
     T("merge()")
     A["…[🟪 🟪 🟪][🟪 🟪]…"] -->|a| T
     B["…[🟨 🟨][🟨][🟨 🟨 🟨]…"] -->|b| T
     O["… 🟩 🟥 🟥 🟩 🟥 …"] -->|select|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