// CopyTo invokes the DOM method. Creates a deep copy of the specified node
// and places it into the target container before the given anchor.
333598
func (d *domainClient) CopyTo(ctx context.Context, args *CopyToArgs) (reply *CopyToReply, err error) {
	reply = new(CopyToReply)
	if args != nil {
		err = rpcc.Invoke(ctx, "DOM.copyTo", args, reply, d.conn)
	} else {
		err = rpcc.Invoke(ctx, "DOM.copyTo", nil, reply, d.conn)
	}
	if err != nil {
		err = &internal.OpError{Domain: "DOM", Op: "CopyTo", Err: err}
	}
	return
}
1354595
func (d Dockerfile) WriteTo(w io.Writer) (n int64, err error) {
	bw := bufio.NewWriter(w)
	defer bw.Flush()
	i, err := bw.WriteString(fmt.Sprintf("## RECREATED FROM IMAGE ON %s\n", time.Now().Format(time.RFC3339)))
	if err != nil {
		return n, err
	}
	n += int64(i)
	i, err = bw.WriteString(fmt.Sprintf("## %s:%s (%s)\n\n", d.Ref.Name, d.Ref.Tag, d.Ref.ID))
	if err != nil {
		return n, err
	}
	n += int64(i)
	for _, layer := range d.Layers {
		i, err = bw.WriteString(layer.DockerfileInstruction().String() + "\n")
		if err != nil {
			return n, err
		}
		n += int64(i)
	}
	return n, nil
}
1310806
func (tx *Tx) CopyTo(w io.Writer, query interface{}, params ...interface{}) (res Result, err error) {
	err = tx.withConn(context.TODO(), func(cn *pool.Conn) error {
		res, err = tx.db.copyTo(cn, w, query, params...)
		return err
	})
	return res, err
}
338466
func (d *Dir) Copy() (*Dir, error) {
	var err error
	var nodescopy = make([]os.FileInfo, len(d.nodes))
	for i := 0; i < len(d.nodes); i++ {
		if d.nodes[i].IsDir() {
			var dir = d.nodes[i].(*Dir)
			nodescopy[i], err = dir.Copy()
			if err != nil {
				return nil, err
			}
		} else {
			var file = d.nodes[i].(*File)
			nodescopy[i], err = file.Copy()
			if err != nil {
				return nil, err
			}
		}
	}
	return &Dir{
		name:     d.name,
		filemode: d.filemode,
		time:     d.time,
		nodes:    nodescopy,
	}, nil
}
142241
func copyAttributes(dst *Node, src Token) {
	if len(src.Attr) == 0 {
		return
	}
	attr := map[string]string{}
	for _, t := range dst.Attr {
		attr[t.Key] = t.Val
	}
	for _, t := range src.Attr {
		if _, ok := attr[t.Key]; !ok {
			dst.Attr = append(dst.Attr, t)
			attr[t.Key] = t.Val
		}
	}
}
858962
func (c *Client) CopyTemplate(p *CopyTemplateParameter) (*Template, error) {
	obj, err := c.Request("copyTemplate", convertParamToMap(p))
	if err != nil {
		return nil, err
	}
	return obj.(*Template), err
}
1128436
func (n *Node) clone() *Node {
	m := &Node{
		Type:     n.Type,
		DataAtom: n.DataAtom,
		Data:     n.Data,
		Attr:     make([]Attribute, len(n.Attr)),
	}
	copy(m.Attr, n.Attr)
	return m
}
1271831
func (c *Container) WriteTo(w io.Writer) (n int64, err error) {
	if c.isArray() {
		return c.arrayWriteTo(w)
	} else if c.isRun() {
		return c.runWriteTo(w)
	} else {
		return c.bitmapWriteTo(w)
	}
}
760890
func (ds *DestSme) SerializeTo(w io.Writer) error {
	_, err := w.Write(ds.Bytes())
	return err
}
971100
func (tag *Tag) WriteTo(w io.Writer) (n int64, err error) {
	if w == nil {
		return 0, errors.New("w is nil")
	}

	// Count size of frames.
	framesSize := tag.Size() - tagHeaderSize
	if framesSize <= 0 {
		return 0, nil
	}

	// Write tag header.
	bw := getBufWriter(w)
	defer putBufWriter(bw)
	writeTagHeader(bw, uint(framesSize), tag.version)

	// Write frames.
	synchSafe := tag.Version() == 4
	err = tag.iterateOverAllFrames(func(id string, f Framer) error {
		return writeFrame(bw, id, f, synchSafe)
	})
	if err != nil {
		bw.Flush()
		return bw.Written(), err
	}

	return bw.Written(), bw.Flush()
}
8126
func copyNodeEvents(events []*NodeEvent) []*NodeEvent {
	l := len(events)
	if l == 0 {
		return nil
	}

	c := make([]*NodeEvent, l)
	for i, event := range events {
		c[i] = event.Copy()
	}
	return c
}
1276046
func (r *copyReader) WriteTo(w io.Writer) (int64, error) {
	if r.WriterTo == nil {
		return 0, nil
	}

	return r.WriterTo.WriteTo(w)
}
996220
func (n *Node) Clone() *Node {
	var c Node
	c.Copy(n)
	return &c
}
1144240
func (p *PortMod) WriteTo(w io.Writer) (int64, error) {
	return encoding.WriteTo(w, p.PortNo, pad4{}, p.HWAddr, pad2{},
		p.Config, p.Mask, p.Advertise, pad4{},
	)
}
847139
func (e *Entity) WriteTo(w io.Writer) error {
	ew, err := CreateWriter(w, e.Header)
	if err != nil {
		return err
	}
	defer ew.Close()

	return e.writeBodyTo(ew)
}
1358800
func (c Contents) WriteTo(w io.Writer) (n int64, err error) {
	for i := 0; i < len(c)-1; i++ {
		x, e := fmt.Fprintf(w, "%s%s", strings.Join(c[i], colDelimiter), rowDelimiter)
		if e != nil {
			return
		}
		n += int64(x)
	}
	if i := len(c) - 1; i > 0 {
		x, e := fmt.Fprintf(w, "%s", strings.Join(c[i], colDelimiter))
		if e != nil {
			return n, e
		}
		n += int64(x)
	}
	return
}
1094927
func (r *Runtime) ExportTo(v Value, target interface{}) error {
	tval := reflect.ValueOf(target)
	if tval.Kind() != reflect.Ptr || tval.IsNil() {
		return errors.New("target must be a non-nil pointer")
	}
	vv, err := r.toReflectValue(v, tval.Elem().Type())
	if err != nil {
		return err
	}
	tval.Elem().Set(vv)
	return nil
}