Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Container ¶
type Container[T any] interface { // Add consumes an item Add(item T) bool // Full return true if container is full Full() bool // returns items as slice Items() []T }
Container is a collection of items More functions like remove can be added if future use cases arise
func NewBounded ¶
NewBounded returns a container of type bounded. Bounded is a container with limited capacity and stops consuming more elements once capacity is reached.
func NewFIFO ¶
NewFIFO returns a container of type fifo. fifo is a container with limited capacity which keeps last 'N' inserted elements upto capacity. Additionally in order to do any cleanup on removed elements a cleanup function can be passed as well.
func NewUnbounded ¶
NewUnbounded returns a container of type unbounded. unbounded is a container with unlimited capacity.
Click to show internal directories.
Click to hide internal directories.