ToonEx.Btoon.Binary (toon_ex v1.3.1)

Copy Markdown View Source

Wraps a raw binary value so the encoder emits tag 0x08 (Binary) instead of tag 0x07 (String). Plain Elixir binaries are always encoded as UTF-8 strings.

Examples

iex> Btoon.encode!(%{"blob" => Btoon.Binary.new(<<1, 2, 3>>)})
<<66, 84, 79, 78, 1, 0, 0, 0, 10, 1, 0, 0, 0, 8, 3, 0, 0, 0, 1, 2, 3>>

Summary

Functions

Unwraps the wrapped binary.

Wraps a binary.

Types

t()

@type t() :: %ToonEx.Btoon.Binary{data: binary()}

Functions

data(binary)

@spec data(t()) :: binary()

Unwraps the wrapped binary.

new(data)

@spec new(binary()) :: t()

Wraps a binary.