Documentation ¶
Overview ¶
Package clone provides functions to deep clone any Go data. It also provides a wrapper to protect a pointer from any unexpected mutation.
This package is only a proxy to original go-clone package with generic support. To minimize the maintenace cost, there is no doc in this package. Please read the document in https://pkg.go.dev/github.com/huandu/go-clone instead.
Index ¶
- func Clone[T any](t T) T
- func IsScalar(k reflect.Kind) bool
- func MarkAsOpaquePointer(t reflect.Type)
- func MarkAsScalar(t reflect.Type)
- func RegisterAtomicPointer[T any]()
- func SetCustomFunc(t reflect.Type, fn Func)
- func Slowly[T any](t T) T
- func Undo[T any](t T)
- func Unwrap[T any](t T) T
- func Wrap[T any](t T) T
- type Allocator
- type AllocatorMethods
- type Cloner
- type Func
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MarkAsOpaquePointer ¶
func MarkAsScalar ¶
func RegisterAtomicPointer ¶
func RegisterAtomicPointer[T any]()
RegisterAtomicPointer registers a custom clone function for atomic.Pointer[T].
func SetCustomFunc ¶
Types ¶
type Allocator ¶ added in v1.5.0
type Allocator = clone.Allocator
func NewAllocator ¶ added in v1.5.0
func NewAllocator(pool unsafe.Pointer, methods *AllocatorMethods) (allocator *Allocator)
type AllocatorMethods ¶ added in v1.5.0
type AllocatorMethods = clone.AllocatorMethods
Click to show internal directories.
Click to hide internal directories.