# `ToonEx.Btoon.Extension`
[🔗](https://github.com/ohhi-vn/toon_ex/blob/v1.6.0/lib/toon_ex/btoon/types.ex#L279)

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:

  * `0xF0`–`0xF7` — experimental / vendor-specific
  * `0xF8`–`0xFB` — official (registered with the maintainers)
  * `0xFC`–`0xFF` — 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>>}

# `t`

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

# `tag`

```elixir
@type tag() :: 240..255
```

# `data`

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

The payload bytes.

# `extension_tag?`

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

Whether the byte is an extension tag.

# `new`

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

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

---

*Consult [api-reference.md](api-reference.md) for complete listing*
