-
Notifications
You must be signed in to change notification settings - Fork 3
/
atomic.go
32 lines (24 loc) · 1.04 KB
/
atomic.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package atomicKit
import (
"go.uber.org/atomic"
"time"
"unsafe"
)
var (
NewBool func(val bool) *atomic.Bool = atomic.NewBool
NewFloat32 func(val float32) *atomic.Float32 = atomic.NewFloat32
NewFloat64 func(val float64) *atomic.Float64 = atomic.NewFloat64
NewInt32 func(val int32) *atomic.Int32 = atomic.NewInt32
NewInt64 func(val int64) *atomic.Int64 = atomic.NewInt64
NewUint32 func(val uint32) *atomic.Uint32 = atomic.NewUint32
NewUint64 func(val uint64) *atomic.Uint64 = atomic.NewUint64
NewString func(val string) *atomic.String = atomic.NewString
NewTime func(val time.Time) *atomic.Time = atomic.NewTime
NewDuration func(val time.Duration) *atomic.Duration = atomic.NewDuration
NewUintptr func(val uintptr) *atomic.Uintptr = atomic.NewUintptr
NewUnsafePointer func(val unsafe.Pointer) *atomic.UnsafePointer = atomic.NewUnsafePointer
NewError func(val error) *atomic.Error = atomic.NewError
)
func NewPointer[T any](v *T) *atomic.Pointer[T] {
return atomic.NewPointer(v)
}