View Source Qu.Priority (qu v0.1.0)

Priority queue implementation.

Summary

Types

@type item() :: {key(), value()}
@type key() :: any()
@type max_size() :: pos_integer() | nil
@type order() :: :desc | :asc | {:desc, module()} | {:asc, module()}
@type size() :: non_neg_integer()
@type t() :: %Qu.Priority{
  heap: PairingHeap.t(),
  max_size: max_size(),
  size: non_neg_integer()
}
@type value() :: any()

Functions

Link to this function

new(order, max_size \\ nil)

View Source
@spec new(order(), max_size()) :: t()
@spec peek(t()) :: {:ok, item()} | :error
@spec pop(t()) :: {:ok, item(), t()} | :error
@spec put(t(), item()) :: {:ok, t()} | :error
@spec size(t()) :: size()