gs

package module
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: MIT Imports: 1 Imported by: 0

README

gs

Package gs exposes some of sync package's types and subpackages with a generic layer built on top.

Improved DevX (compile-time checks, and you avoid dealing with any/interface{}).

Supported types

Supported subpackages

Other

atomic.CloseSafeChan is a chan wrapper that guarantees safe concurrent closing operations on the channel.

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
}

func (*Map[K, V]) CompareAndDelete

func (m *Map[K, V]) CompareAndDelete(key K, old V) (deleted bool)

func (*Map[K, V]) CompareAndSwap

func (m *Map[K, V]) CompareAndSwap(key K, old V, new V) (swaped bool)

func (*Map[K, _]) Delete

func (m *Map[K, _]) Delete(key K)

func (*Map[K, V]) Load

func (m *Map[K, V]) Load(key K) (value V, found bool)

func (*Map[K, V]) LoadAndDelete

func (m *Map[K, V]) LoadAndDelete(key K) (value V, loaded bool)

func (*Map[K, V]) LoadOrStore

func (m *Map[K, V]) LoadOrStore(key K, value V) (actual V, loaded bool)

func (*Map[K, V]) Range

func (m *Map[K, V]) Range(f func(key K, value V) bool)

func (*Map[K, V]) Store

func (m *Map[K, V]) Store(key K, value V)

func (*Map[K, V]) Swap

func (m *Map[K, V]) Swap(key K, value V) (previous V, loaded bool)

type Pool added in v0.2.0

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

func NewPool added in v0.2.0

func NewPool[T any](new func() T) Pool[T]

func (*Pool[T]) Get added in v0.2.0

func (p *Pool[T]) Get() T

func (*Pool[T]) Put added in v0.2.0

func (p *Pool[T]) Put(x T)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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