Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Value ¶
type Value[T comparable] struct { // contains filtered or unexported fields }
Value is type-param version of sync/atomic.Value. T is constrained to be complarable, because internal atomic.Value checks equality by comparison.
Zero Value is invalid, without proceeding Store call.
func NewValue ¶
func NewValue[T comparable]() Value[T]
NewValue returns newly created Value with inner value populated as zero of T.
func (*Value[T]) CompareAndSwap ¶
CompareAndSwap does compare-and-swap operation for T.
`swapped` is always false if value is not stored. To avoid this, call Store beforehand or use v initialized by NewValue.
Click to show internal directories.
Click to hide internal directories.