MCPcopy Create free account
hub / github.com/cogentcore/core / CopyFrom

Method CopyFrom

tree/nodebase.go:662–668  ·  view source on GitHub ↗

Deep Copy: note: we use the copy from direction (instead of copy to), as the receiver is modified whereas the from is not and assignment is typically in the same direction. CopyFrom copies the data and children of the given node to this node. It is essential that the source node has unique names. It

(from Node)

Source from the content-addressed store, hash-verified

660// should not be copied. Also, unexported fields are not copied.
661// See [Node.CopyFieldsFrom] for more information on field copying.
662func (n *NodeBase) CopyFrom(from Node) {
663 if from == nil {
664 slog.Error("tree.NodeBase.CopyFrom: nil source", "destinationNode", n)
665 return
666 }
667 copyFrom(n.This, from)
668}
669
670// copyFrom is the implementation of [NodeBase.CopyFrom].
671func copyFrom(to, from Node) {

Callers

nothing calls this directly

Calls 2

copyFromFunction · 0.85
ErrorMethod · 0.65

Tested by

no test coverage detected