Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AtomicFloat64 ¶
AtomicFloat64 is an atomic float64 variable.
func (*AtomicFloat64) Add ¶
func (x *AtomicFloat64) Add(delta float64) (new float64)
Add atomically adds delta to this value and returns the result.
This will not compile down to a single instruction, because no one provides that. Instead, this just does a CAS loop.
func (*AtomicFloat64) BitwiseCompareAndSwap ¶
func (x *AtomicFloat64) BitwiseCompareAndSwap(old, new float64) (swapped bool)
Swap atomically stores the given float64 if x currently holds a float with the same bit-pattern as val.
That is to say, this does *not* perform a floating-point comparison!
func (*AtomicFloat64) Load ¶
func (x *AtomicFloat64) Load() float64
Load atomically loads the wrapped float64.
func (*AtomicFloat64) Store ¶
func (x *AtomicFloat64) Store(val float64)
Store atomically stores the passed float64.
func (*AtomicFloat64) Swap ¶
func (x *AtomicFloat64) Swap(val float64) (old float64)
Swap atomically stores the given float64 and returns the old value.
type Map ¶
type Map[K comparable, V any] struct { // contains filtered or unexported fields }
Map is a strongly-typed wrapper over sync.Map.
func (*Map[K, V]) All ¶
All returns an iterator over the values in this map, using sync.Map.Range.
func (*Map[K, V]) LoadOrStore ¶
LoadOrStore loads a value if its present, or constructs it with make and inserts it.
There is a possibility that make is called, but the return value is not inserted.
type Pool ¶
type Pool[T any] struct { New func() *T // Called to construct new values. Reset func(*T) // Called to reset values before re-use. // contains filtered or unexported fields }
Pool is like sync.Pool, but strongly typed to make the interface a bit less messy.
type Set ¶
type Set[K comparable] struct { // contains filtered or unexported fields }
Set is a strongly-typed wrapper over sync.Map, used as a set.
func (*Set[K]) All ¶
All returns an iterator over the values in this set, using sync.Map.Range.