ToonEx.Btoon.Extension (toon_ex v1.6.0)

Copy Markdown View Source

A registered extension value (tags 0xF0..0xFF).

Extension types are the forward-compatible escape hatch of the BTOON wire format: an extension value is encoded as its tag, a length prefix and the raw payload, so any decoder can skip an unimplemented extension instead of failing. The payload's internal layout is defined by the extension's registration.

Tag ranges:

  • 0xF00xF7 — experimental / vendor-specific
  • 0xF80xFB — official (registered with the maintainers)
  • 0xFC0xFF — private / application-local

Examples

iex> ext = Btoon.Extension.new(0xF0, <<1, 2, 3>>)
iex> Btoon.decode!(Btoon.encode!(ext))
%Btoon.Extension{tag: 240, data: <<1, 2, 3>>}

Summary

Functions

The payload bytes.

Whether the byte is an extension tag.

Wraps a payload under an extension tag in 0xF0..0xFF.

Types

t()

@type t() :: %ToonEx.Btoon.Extension{data: binary(), tag: tag()}

tag()

@type tag() :: 240..255

Functions

data(extension)

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

The payload bytes.

extension_tag?(byte)

@spec extension_tag?(byte()) :: boolean()

Whether the byte is an extension tag.

new(tag, data)

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

Wraps a payload under an extension tag in 0xF0..0xFF.