clone

package module
v0.0.0-...-2e9ef76 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2022 License: LGPL-3.0 Imports: 0 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Interface

func Interface[T Cloner[T]](x Cloner[T]) T

Interface clones an interface pointer.

func Map

func Map[T Cloner[T], U comparable](xs map[U]T) map[U]T

Map clones a map of cloneable values.

func P

func P[T any](x T) *T

P creates a value pointer from a value. Use with care.

func Shallow

func Shallow[T any](x *T) *T

Shallow shallow clones (copies) a value.

func Slice

func Slice[T Cloner[T]](xs []T) []T

Slice clones a slice of cloneable values.

func ValuePointer

func ValuePointer[V any, T interface {
	Cloner[*V]
	*V
}](x T) T

ValuePointer clones a value pointer.

Types

type Cloner

type Cloner[T any] interface {
	Clone() T
}

Cloner is what anything cloneable must implement.

Jump to

Keyboard shortcuts

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