Skip to content

Count[A: Any val]

[Source]

Read a count field, then decode that many instances of the body codec.

On encode, write the array length as the count, then encode each element. The count field is structural — it does not appear in the decoded type.

class val Count[A: Any val] is
  Codec[Array[A] val] val

Implements


Constructors

create

[Source]

new val create(
  count_codec: Codec[U16 val] val,
  body_codec: Codec[A] val)
: Count[A] val^

Parameters

Returns


Public Functions

decode

[Source]

Decode a count followed by that many elements.

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

Parameters

Returns


encode

[Source]

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

Parameters

Returns