Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConcurrentSlice ¶
ConcurrentSlice type that can be safely shared between goroutines.
func NewConcurrentSlice ¶
func NewConcurrentSlice[T any]() *ConcurrentSlice[T]
NewConcurrentSlice creates a new synchronized slice.
func (*ConcurrentSlice[T]) Append ¶
func (cs *ConcurrentSlice[T]) Append(item T)
Append adds an item to the concurrent slice.
func (*ConcurrentSlice[T]) Delete ¶
func (cs *ConcurrentSlice[T]) Delete(index int)
Delete an item from the slice
func (*ConcurrentSlice[T]) Get ¶
func (cs *ConcurrentSlice[T]) Get(index int) (item any)
Get returns the slice item at the given index
func (*ConcurrentSlice[T]) Iter ¶
func (cs *ConcurrentSlice[T]) Iter() <-chan Item[T]
Iter iterates the items in the concurrent slice. Each item is sent over a channel, so that we can iterate over the slice using the builtin range keyword.
func (*ConcurrentSlice[T]) Len ¶
func (cs *ConcurrentSlice[T]) Len() int
Len returns the number of items
Click to show internal directories.
Click to hide internal directories.