demux

It is used to distribute the data received at its input to one of its outputs.

demux(ctrl: Uint, din, *, fcat=ccat, nout=None) -> (din, ...)

Sends the data received at din to one of its outputs designated by the value received at ctrl. The number of outputs is either determined by the value of the nout parameter, or equals 2**len(ctrl) if nout is not specified.

ctrl = drv(t=Uint[2], seq=[0, 1, 2, 3])
outs = drv(t=Uint[4], seq=[10, 11, 12, 13]) \
    | demux(ctrl)

outs[0] | check(ref=[10])
outs[1] | check(ref=[11])
outs[2] | check(ref=[12])
outs[3] | check(ref=[13])
demux(din: Union) -> (din.types[0], din.types[1], ...)

Acts as a switch for the data of the Union type. It has one output for each of the Union subtypes.