# `Quic.CryptoReassembly`
[🔗](https://github.com/gsmlg-dev/http_fetch/blob/v1.0.0-rc.9/apps/elixir_quic/lib/quic/crypto_reassembly.ex#L1)

Bounded sparse storage for one QUIC CRYPTO stream.

Offsets are absolute and the store never allocates a buffer proportional to a
future offset.  Overlapping bytes must agree; once bytes are delivered they
are removed and cannot be delivered twice.

# `initial_state`

```elixir
@type initial_state() :: %Quic.CryptoReassembly{
  buffered_bytes: 0,
  intervals: [],
  max_bytes: term(),
  max_intervals: term(),
  next: 0
}
```

# `t`

```elixir
@type t() :: %Quic.CryptoReassembly{
  buffered_bytes: term(),
  intervals: term(),
  max_bytes: term(),
  max_intervals: term(),
  next: term()
}
```

# `buffered_bytes`

```elixir
@spec buffered_bytes(t()) :: non_neg_integer()
```

# `intervals`

```elixir
@spec intervals(t()) :: [{non_neg_integer(), binary()}]
```

# `new`

```elixir
@spec new(keyword()) :: initial_state()
```

# `next_offset`

```elixir
@spec next_offset(t()) :: non_neg_integer()
```

# `put`

```elixir
@spec put(t(), non_neg_integer(), binary()) :: {:ok, t(), binary()} | {:error, atom()}
```

Insert a sparse range and return newly contiguous bytes, if any.

---

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