Erlang-specific value extensions layered on top of core MessagePack.
Each extension is a MessagePack ext payload tagged with one of the type
codes below. Encoding is always safe. Decoding never creates atoms and
never fabricates PIDs/references from arbitrary bytes: it delegates to
:erlang.binary_to_term/2 with the :safe option (which refuses to
create new atoms and refuses function values) and then re-validates the
resulting term's shape before accepting it.
Summary
Functions
Decode atom bytes to an existing atom only. Never creates a new atom.
Returns {:error, {:unsafe_atom, text}} if the atom does not already exist.
Decode PID bytes safely: only ever accepts input that :erlang.binary_to_term/2
with :safe decodes to an actual pid(). Any other shape is rejected without
raising and without creating atoms.
Encode an atom as its UTF-8 text. Any atom, including unicode atoms, is representable.
Encode an arbitrary-size integer as its big-endian two's complement representation.
Encode a local or distributed PID using :erlang.term_to_binary/1.
Types
Functions
Decode atom bytes to an existing atom only. Never creates a new atom.
Returns {:error, {:unsafe_atom, text}} if the atom does not already exist.
Decode PID bytes safely: only ever accepts input that :erlang.binary_to_term/2
with :safe decodes to an actual pid(). Any other shape is rejected without
raising and without creating atoms.
Encode an atom as its UTF-8 text. Any atom, including unicode atoms, is representable.
Encode an arbitrary-size integer as its big-endian two's complement representation.
Encode a local or distributed PID using :erlang.term_to_binary/1.
@spec ext_type_code(ext_type()) :: non_neg_integer()
@spec ext_type_name(non_neg_integer()) :: {:ok, ext_type()} | :error