drive_clone.go 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // Copyright (c) Tailscale Inc & AUTHORS
  2. // SPDX-License-Identifier: BSD-3-Clause
  3. // Code generated by tailscale.com/cmd/cloner; DO NOT EDIT.
  4. package drive
  5. // Clone makes a deep copy of Share.
  6. // The result aliases no memory with the original.
  7. func (src *Share) Clone() *Share {
  8. if src == nil {
  9. return nil
  10. }
  11. dst := new(Share)
  12. *dst = *src
  13. dst.BookmarkData = append(src.BookmarkData[:0:0], src.BookmarkData...)
  14. return dst
  15. }
  16. // A compilation failure here means this code must be regenerated, with the command at the top of this file.
  17. var _ShareCloneNeedsRegeneration = Share(struct {
  18. Name string
  19. Path string
  20. As string
  21. BookmarkData []byte
  22. }{})
  23. // Clone duplicates src into dst and reports whether it succeeded.
  24. // To succeed, <src, dst> must be of types <*T, *T> or <*T, **T>,
  25. // where T is one of Share.
  26. func Clone(dst, src any) bool {
  27. switch src := src.(type) {
  28. case *Share:
  29. switch dst := dst.(type) {
  30. case *Share:
  31. *dst = *src.Clone()
  32. return true
  33. case **Share:
  34. *dst = src.Clone()
  35. return true
  36. }
  37. }
  38. return false
  39. }