Owned state for isolated synchronous snippet-highlight requests.
Summary
Functions
Allocates an isolated parser buffer and records its request.
Fetches a pending snippet request.
Constructs empty snippet request state.
Returns the parser buffer ID allocated by the next request.
Removes a pending snippet request.
Updates a pending snippet request.
Removes every pending snippet request.
Types
@type pending_highlight() :: %{ from: GenServer.from(), names: [String.t()] | nil, spans: [Minga.Language.Highlight.Span.t()] | nil, timer_ref: reference() }
@type t() :: %Minga.Parser.SnippetState{ next_buffer_id: non_neg_integer(), pending: %{required(non_neg_integer()) => pending_highlight()} }
Functions
@spec allocate(t(), pending_highlight()) :: {non_neg_integer(), t()}
Allocates an isolated parser buffer and records its request.
@spec fetch(t(), non_neg_integer()) :: {:ok, pending_highlight()} | :error
Fetches a pending snippet request.
@spec new() :: t()
Constructs empty snippet request state.
@spec next_buffer_id(t()) :: non_neg_integer()
Returns the parser buffer ID allocated by the next request.
@spec pop(t(), non_neg_integer()) :: {pending_highlight() | nil, t()}
Removes a pending snippet request.
@spec put(t(), non_neg_integer(), pending_highlight()) :: t()
Updates a pending snippet request.
@spec take_all(t()) :: {[pending_highlight()], t()}
Removes every pending snippet request.