ReductionBounds.ProtocolSize (ReductionBounds v0.1.0)

Copy Markdown View Source

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}}

Summary

Functions

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

Checks both dimensions; unknown information cannot establish inclusion.

Types

dimension()

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

t()

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

Functions

from_iodata(data)

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

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

known?(arg1)

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

within?(actual, bound)

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

Checks both dimensions; unknown information cannot establish inclusion.