objectpool

package
v0.0.0-...-21c9ebe Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 9, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ObjectNotFoundError

type ObjectNotFoundError struct{}

func (*ObjectNotFoundError) Error

func (e *ObjectNotFoundError) Error() string

type ObjectPool

type ObjectPool[T comparable] struct {
	Objects []T
}

ObjectPool stores a collection of object pointers with utility functions to manipulate the pool.

Important note: elements in an ObjectPool will NOT stay in the same order.

func NewObjectPool

func NewObjectPool[T comparable]() *ObjectPool[T]

func (*ObjectPool[T]) Add

func (pool *ObjectPool[T]) Add(obj T)

func (*ObjectPool[T]) Contains

func (pool *ObjectPool[T]) Contains(obj T) bool

func (*ObjectPool[T]) Find

func (pool *ObjectPool[T]) Find(obj T) (int, error)

func (*ObjectPool[T]) FindAndRemove

func (pool *ObjectPool[T]) FindAndRemove(obj T) error

func (*ObjectPool[T]) Remove

func (pool *ObjectPool[T]) Remove(index int)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL