Skip to content

FlatZip[A: Any val, B: Any val]

[Source]

Dependent sequencing: the second codec is determined by the first decoded value.

On decode, A is decoded first, then f(A) produces the codec for B. On encode, A is available from the tuple, so f(A) can produce the encoder for B.

class val FlatZip[A: Any val, B: Any val] is
  Codec[(A , B)] val

Implements


Constructors

create

[Source]

new val create(
  ca: Codec[A] val,
  f: {(A): Codec[B]}[A, B] val)
: FlatZip[A, B] val^

Parameters

  • ca: Codec[A] val
  • f: {(A): Codec[B]}[A, B] val

Returns


Public Functions

decode

[Source]

fun box decode(
  data: Array[U8 val] val,
  offset: USize val)
: (((A , B) , USize val) | DecodeError)

Parameters

Returns


encode

[Source]

fun box encode(
  value: (A , B))
: (Array[U8 val] val | EncodeError)

Parameters

  • value: (A , B)

Returns