// Copyright (c) Tailscale Inc & contributors
// SPDX-License-Identifier: BSD-3-Clause

// Code generated by tailscale.com/cmd/cloner; DO NOT EDIT.

package dnstype

import (
	"net/netip"
)

// Clone makes a deep copy of Resolver.
// The result aliases no memory with the original.
func (src *Resolver) Clone() *Resolver {
	if src == nil {
		return nil
	}
	dst := new(Resolver)
	*dst = *src
	dst.BootstrapResolution = append(src.BootstrapResolution[:0:0], src.BootstrapResolution...)
	return dst
}

// A compilation failure here means this code must be regenerated, with the command at the top of this file.
var _ResolverCloneNeedsRegeneration = Resolver(struct {
	Addr                string
	BootstrapResolution []netip.Addr
	UseWithExitNode     bool
}{})

// Clone duplicates src into dst and reports whether it succeeded.
// To succeed, <src, dst> must be of types <*T, *T> or <*T, **T>,
// where T is one of Resolver.
func Clone(dst, src any) bool {
	switch src := src.(type) {
	case *Resolver:
		switch dst := dst.(type) {
		case *Resolver:
			*dst = *src.Clone()
			return true
		case **Resolver:
			*dst = src.Clone()
			return true
		}
	}
	return false
}
