package deepcopy

import "github.com/moby/swarmkit/v2/api/deepcopy"

Index

Functions

func Copy

func Copy(dst, src interface{})

Copy copies src into dst. dst and src must have the same type.

If the type has a copy function defined, it will be used.

Default implementations for builtin types and well known protobuf types may be provided.

If the copy cannot be performed, this function will panic. Make sure to test types that use this function.

Types

type CopierFrom

type CopierFrom interface {
	// Copy takes the fields from src and copies them into the target object.
	//
	// Calling this method with a nil receiver or a nil src may panic.
	CopyFrom(src interface{})
}

CopierFrom can be implemented if an object knows how to copy another into itself.

Source Files

copy.go

Version
v2.0.0-20250103191802-8c1959736554 (latest)
Published
Jan 3, 2025
Platform
js/wasm
Imports
3 packages
Last checked
1 week ago

Tools for package owners.