sync

package
v0.8.3 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Map

type Map[K comparable, V any] struct {
	// contains filtered or unexported fields
}

Map is a mutex synchronized map for concurrent use.

func NewMap

func NewMap[K comparable, V any](size int) *Map[K, V]

func (*Map[K, V]) Access

func (m *Map[K, V]) Access(fn func(s map[K]V) error) error

Access executes fn exclusively and passes the underlying slice.

WARNING: Do not alias and use s outside of fn!

func (*Map[K, V]) Clear

func (m *Map[K, V]) Clear()

func (*Map[K, V]) Delete

func (m *Map[K, V]) Delete(k K)

func (*Map[K, V]) Get

func (m *Map[K, V]) Get(k K) (value V, ok bool)

func (*Map[K, V]) GetValue

func (m *Map[K, V]) GetValue(k K) (value V)

func (*Map[K, V]) Len

func (m *Map[K, V]) Len() int

func (*Map[K, V]) Seq added in v0.5.1

func (m *Map[K, V]) Seq() iter.Seq2[K, V]

func (*Map[K, V]) SeqRead added in v0.7.1

func (m *Map[K, V]) SeqRead() iter.Seq2[K, V]

func (*Map[K, V]) Set

func (m *Map[K, V]) Set(k K, v V)

type Slice

type Slice[T any] struct {
	// contains filtered or unexported fields
}

Slice is a mutex synchronized slice for concurrent use.

func NewSlice

func NewSlice[T any](capacity int) *Slice[T]

func (*Slice[T]) Access

func (a *Slice[T]) Access(fn func(s []T) error) error

Access executes fn exclusively and passes the underlying slice.

WARNING: Do not alias and use s outside of fn!

func (*Slice[T]) Append

func (a *Slice[T]) Append(t T) (index int)

func (*Slice[T]) At

func (a *Slice[T]) At(index int) T

func (*Slice[T]) Len

func (a *Slice[T]) Len() int

func (*Slice[T]) Seq

func (a *Slice[T]) Seq() iter.Seq[T]

func (*Slice[T]) SeqRead added in v0.7.1

func (a *Slice[T]) SeqRead() iter.Seq[T]

Jump to

Keyboard shortcuts

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