# `ReductionBounds.ProtocolSize`
[🔗](https://github.com/zacky1972/reduction_bounds/blob/v0.1.0/lib/reduction_bounds/protocol_size.ex#L1)

Independent byte and structural bounds for communication data.

A structural unit is one binary, byte, empty list, or list cell. Binary
traversal work must still use its byte bound. For example, nested empty
lists have zero bytes but nonzero structural size. The convention is a
mathematical measure, not a statement about ERTS traversal or allocation.

`from_iodata/1` measures valid iodata, including binary tails. Scalar bytes
are permitted inside lists, not as top-level iodata. Unknown information is
explicit and is never silently interpreted as zero.

    iex> ReductionBounds.ProtocolSize.from_iodata([[], []])
    {:ok, %ReductionBounds.ProtocolSize{bytes: 0, structure: 5}}

# `dimension`

```elixir
@type dimension() :: non_neg_integer() | :unknown
```

# `t`

```elixir
@type t() :: %ReductionBounds.ProtocolSize{bytes: dimension(), structure: dimension()}
```

# `from_iodata`

```elixir
@spec from_iodata(term()) :: {:ok, t()} | {:error, term()}
```

Measures valid iodata in Elixir; association with target data remains an assumption.

# `known?`

```elixir
@spec known?(term()) :: boolean()
```

# `within?`

```elixir
@spec within?(t(), t()) :: boolean()
```

Checks both dimensions; unknown information cannot establish inclusion.

---

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