# `Minga.Parser.SnippetState`
[🔗](https://github.com/jsmestad/minga/blob/main/lib/minga/parser/snippet_state.ex#L1)

Owned state for isolated synchronous snippet-highlight requests.

# `pending_highlight`

```elixir
@type pending_highlight() :: %{
  from: GenServer.from(),
  names: [String.t()] | nil,
  spans: [Minga.Language.Highlight.Span.t()] | nil,
  timer_ref: reference()
}
```

# `t`

```elixir
@type t() :: %Minga.Parser.SnippetState{
  next_buffer_id: non_neg_integer(),
  pending: %{required(non_neg_integer()) =&gt; pending_highlight()}
}
```

# `allocate`

```elixir
@spec allocate(t(), pending_highlight()) :: {non_neg_integer(), t()}
```

Allocates an isolated parser buffer and records its request.

# `fetch`

```elixir
@spec fetch(t(), non_neg_integer()) :: {:ok, pending_highlight()} | :error
```

Fetches a pending snippet request.

# `new`

```elixir
@spec new() :: t()
```

Constructs empty snippet request state.

# `next_buffer_id`

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

Returns the parser buffer ID allocated by the next request.

# `pop`

```elixir
@spec pop(t(), non_neg_integer()) :: {pending_highlight() | nil, t()}
```

Removes a pending snippet request.

# `put`

```elixir
@spec put(t(), non_neg_integer(), pending_highlight()) :: t()
```

Updates a pending snippet request.

# `take_all`

```elixir
@spec take_all(t()) :: {[pending_highlight()], t()}
```

Removes every pending snippet request.

---

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