Type definitions and wrapper types for the BTOON codec.
The BTOON data model mirrors TOON: nil, booleans, integers, floats,
UTF-8 strings, binary blobs, arrays and objects. Elixir strings are
binaries, so two wrapper structs exist to disambiguate values that are
otherwise indistinguishable:
Btoon.Binary– a binary value (tag0x08) as opposed to a string (tag0x07).Btoon.TypedArray– a contiguous, homogeneous numeric buffer (tag0x0C).Btoon.ObjectTable– a columnar table of homogeneous numeric columns (tag0x0D).
Element types
Element types are named atoms (:int8, :uint8, :int16, :uint16,
:int32, :uint32, :int64, :uint64, :float32, :float64) and,
for schema fields only, :null, :bool, :string, :binary, :array
and :object. See Btoon.ElementType.
Summary
Types
A single decoding option.
Options accepted by Btoon.decode/2 and Btoon.decode!/2.
An element type selector atom.
Any value that can be encoded by Btoon.
A single encoding option.
Options accepted by Btoon.encode/2 and Btoon.encode!/2.
A BTOON primitive value.
Types
@type decode_opt() :: {:dictionary, ToonEx.Btoon.Dictionary.t() | nil} | {:schema, ToonEx.Btoon.Schema.t() | nil} | {:keys, :strings | :atoms | :atoms!} | {:typed_arrays, :lists | :views} | {:max_depth, pos_integer()}
A single decoding option.
@type decode_opts() :: [decode_opt()]
Options accepted by Btoon.decode/2 and Btoon.decode!/2.
@type element_type() ::
:int8
| :uint8
| :int16
| :uint16
| :int32
| :uint32
| :int64
| :uint64
| :float32
| :float64
| :null
| :bool
| :string
| :binary
| :array
| :object
An element type selector atom.
@type encodable() :: nil | boolean() | integer() | float() | String.t() | ToonEx.Btoon.Binary.t() | ToonEx.Btoon.TypedArray.t() | ToonEx.Btoon.ObjectTable.t() | [encodable()] | %{optional(String.t()) => encodable()}
Any value that can be encoded by Btoon.
@type encode_opt() :: {:dictionary, ToonEx.Btoon.Dictionary.t() | nil} | {:string_table, :auto | :off} | {:schema, ToonEx.Btoon.Schema.t() | nil} | {:typed_arrays, boolean()} | {:object_tables, boolean()}
A single encoding option.
@type encode_opts() :: [encode_opt()]
Options accepted by Btoon.encode/2 and Btoon.encode!/2.
@type primitive() :: nil | boolean() | integer() | float() | String.t() | ToonEx.Btoon.Binary.t()
A BTOON primitive value.