Skip to content

package pooling

import "kaijuengine.com/engine/pooling"

Constants

ElementsInPool

256

Types

AtomicPoolGroup

PoolGroup[T]

type AtomicPoolGroup[T any] PoolGroup[T]

AtomicPoolGroup.Add

func (p *AtomicPoolGroup[T]) Add() (elm *T, poolId PoolGroupId, elmId PoolIndex)

AtomicPoolGroup.Clear

func (p *AtomicPoolGroup[T]) Clear()

AtomicPoolGroup.Count

func (p *AtomicPoolGroup[T]) Count() int

AtomicPoolGroup.Each

func (p *AtomicPoolGroup[T]) Each(each func(elm *T))

AtomicPoolGroup.Remove

func (p *AtomicPoolGroup[T]) Remove(poolIndex PoolGroupId, elementId PoolIndex)

AtomicPoolGroup.Reserve

func (p *AtomicPoolGroup[T]) Reserve(additionalElements int)

Pool

struct

type Pool[T any] struct {
    // Has unexported fields.
}

PoolGroup

struct

type PoolGroup[T any] struct {
    // Has unexported fields.
}

PoolGroup.Add

func (p *PoolGroup[T]) Add() (elm *T, poolId PoolGroupId, elmId PoolIndex)

PoolGroup.All

func (p *PoolGroup[T]) All(each func(elm *T))

Each will iterate through every element, both active and inactive element in the pool and supply it to the expression that was supplied to this function call

PoolGroup.Clear

func (p *PoolGroup[T]) Clear()

PoolGroup.ConditionalEach

func (p *PoolGroup[T]) ConditionalEach(each func(elm *T) bool)

ConditionalEach iterates over each active element in the pool group, invoking the provided callback function each. If the callback returns false for any element, the iteration stops early. This allows callers to break out of the loop based on a condition while still processing elements in order of their allocation.

PoolGroup.Count

func (p *PoolGroup[T]) Count() int

PoolGroup.Each

func (p *PoolGroup[T]) Each(each func(elm *T))

Each will iterate through each active element in the pool and supply it to the expression that was supplied to this function call

PoolGroup.ElementCount

func (p *PoolGroup[T]) ElementCount() int

PoolGroup.Remove

func (p *PoolGroup[T]) Remove(poolIndex PoolGroupId, elementId PoolIndex)

PoolGroup.Reserve

func (p *PoolGroup[T]) Reserve(additionalElements int)

PoolGroupId

int

type PoolGroupId = int

PoolIndex

uint8

type PoolIndex = uint8