View Source Qu.LIFO (qu v0.1.0)

LIFO queue implementation.

Summary

Types

@type item() :: any()
@type max_size() :: pos_integer() | nil
@type size() :: non_neg_integer()
@type t() :: %Qu.LIFO{max_size: max_size(), size: size(), stack: [item()]}

Functions

@spec new(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()