Skip to content

Module dev_codec_structured.erl

A device implementing the codec interface (to/1, from/1) for HyperBEAM's internal, richly typed message format.

Description

This format mirrors HTTP Structured Fields, aside from its limitations of compound type depths, as well as limited floating point representations.

As with all AO-Core codecs, its target format (the format it expects to receive in the to/1 function, and give in from/1) is TABM.

For more details, see the HTTP Structured Fields (RFC-9651) specification.

Function Index

commit/3
decode_ao_types/2Parse the ao-types field of a TABM and return a map of keys and their types.
decode_value/2Convert non-binary values to binary for serialization.
encode_ao_types/2Generate an ao-types structured field from a map of keys and their types.
encode_value/1Convert a term to a binary representation, emitting its type for serialization as a separate tag.
from/3Convert a rich message into a 'Type-Annotated-Binary-Message' (TABM).
implicit_keys/1*Find the implicit keys of a TABM.
implicit_keys/2
is_list_from_ao_types/2Determine if the ao-types field of a TABM indicates that the message is a list.
linkify_mode/2*Discern the linkify mode from the request and the options.
list_encoding_test/0*
to/3Convert a TABM into a native HyperBEAM message.
verify/3

Function Details

commit/3

commit(Msg, Req, Opts) -> any()

decode_ao_types/2

decode_ao_types(Msg, Opts) -> any()

Parse the ao-types field of a TABM and return a map of keys and their types

decode_value/2

decode_value(Type, Value) -> any()

Convert non-binary values to binary for serialization.

encode_ao_types/2

encode_ao_types(Types, Opts) -> any()

Generate an ao-types structured field from a map of keys and their types.

encode_value/1

encode_value(Value) -> any()

Convert a term to a binary representation, emitting its type for serialization as a separate tag.

from/3

from(Bin, Req, Opts) -> any()

Convert a rich message into a 'Type-Annotated-Binary-Message' (TABM).

implicit_keys/1 *

implicit_keys(Req) -> any()

Find the implicit keys of a TABM.

implicit_keys/2

implicit_keys(Req, Opts) -> any()

is_list_from_ao_types/2

is_list_from_ao_types(Types, Opts) -> any()

Determine if the ao-types field of a TABM indicates that the message is a list.

linkify_mode/2 *

linkify_mode(Req, Opts) -> any()

Discern the linkify mode from the request and the options.

list_encoding_test/0 *

list_encoding_test() -> any()

to/3

to(Bin, Req, Opts) -> any()

Convert a TABM into a native HyperBEAM message.

verify/3

verify(Msg, Req, Opts) -> any()