Discriminated[D: (Equatable[D] val & Stringable val), Msg: Any val]¶
Tagged union dispatch: a discriminator codec selects which variant codec to use.
On decode, reads the discriminator and dispatches to the matching variant codec. On encode, tests each variant's narrowing function to find a match, then writes the discriminator followed by the variant body.
Built via DiscriminatedBuilder — not constructed directly.
Implements¶
- Codec[Msg] val
Public Functions¶
decode¶
Parameters¶
Returns¶
- ((Msg , USize val) | DecodeError)
encode¶
Parameters¶
- value: Msg
Returns¶
- (Array[U8 val] val | EncodeError)