MOQX.Codec.Decoder behaviour (moqx v0.8.1)

Copy Markdown View Source

Behaviour for decoding complete payload binaries.

A decoder receives a complete payload binary for a known value shape and returns the corresponding typed value. Protocol-specific stream codecs are responsible for reading stream type prefixes, stripping payload-size fields, managing buffers, and selecting the decoder according to stream state.

Summary

Types

context()

@type context() :: %{optional(atom()) => term()}

result()

@type result() :: term()

t()

@type t() :: module()

Callbacks

decode(binary, context)

@callback decode(binary(), context()) :: {:ok, result()} | {:error, term()}