WireSize

sealed interface WireSize

Reports the encoded byte size of a value.

Codecs that know their size up front return Exact so the framework can pre-allocate. Variable-length codecs (UTF-8 strings, sealed dispatch with variable variants, MQTT v5 properties, generic payloads) return BackPatch; the framework writes into a growable buffer and patches any preceding length-prefix on emit.

Inheritors

Types

Link copied to clipboard
data object BackPatch : WireSize

Framework uses a growable write buffer + back-patches length-prefixed framing.

Link copied to clipboard
value class Exact(val bytes: Int) : WireSize

Codec knows the exact byte count up front; framework pre-allocates.