BTOON decoder.
Parses the BTOON wire format back into the data model:
- Envelope:
"BTON"magic, version, flags, optional per-message string table and embedded schema, then an 8-byte-aligned body. - Tagged values with inline
SmallInt, fixed-width little-endian integers/floats, zero-copy strings and binaries (BEAM sub-binaries). StringRefids resolved against the session dictionary first, then the per-message string table.TypedArrayandObjectTablepayloads materialized as lists or exposed as zero-copy views (typed_arrays: :views).- Schema mode:
SchemaIDfollowed by ordered, tagless fixed-width fields decoded strictly according to the (embedded or supplied) schema.
API
iex> {:ok, value} = Btoon.Decode.decode(<<66, 84, 79, 78, 1, 0, 0, 0, 106>>)
iex> value
42
Summary
Functions
Decodes a BTOON binary.
Decodes a BTOON binary, raising Btoon.DecodeError on error.
Decodes a BTOON binary using pre-validated options.
Decodes a BTOON binary using pre-validated options, raising Btoon.DecodeError on error.
Functions
@spec decode( binary(), keyword() ) :: {:ok, term()} | {:error, ToonEx.Btoon.DecodeError.t()}
Decodes a BTOON binary.
Returns {:ok, value} or {:error, ToonEx.Btoon.DecodeError.t()}.
Decodes a BTOON binary, raising Btoon.DecodeError on error.
@spec decode_validated(binary(), ToonEx.Btoon.Decode.Options.validated()) :: {:ok, term()} | {:error, ToonEx.Btoon.DecodeError.t()}
Decodes a BTOON binary using pre-validated options.
This skips option re-validation, improving throughput for repeated decoding
with the same options. Returns {:ok, value} or {:error, Btoon.DecodeError.t()}.
@spec decode_validated!(binary(), ToonEx.Btoon.Decode.Options.validated()) :: term()
Decodes a BTOON binary using pre-validated options, raising Btoon.DecodeError on error.