// copy copies as much as it can from r.buf into b. If it succeeds in copying
// all of the data, r.done is called.
349419
func (r *Reader) copy(b []byte) (n int) {
	n += copy(b, r.buf)
	if len(r.buf) >= n {
		// If there's still some buffered data left, truncate the buffer
		// and return.
		r.buf = r.buf[n:]
	}

	if len(r.buf) == 0 {
		r.done()
	}

	return
}
596784
func (td *TrianglesData) Copy() Triangles {
	copyTd := MakeTrianglesData(td.Len())
	copyTd.Update(td)
	return copyTd
}
703020
func copyBuf(w io.Writer, r io.Reader) (int64, error) {
	buf := buffer32KPool.Get().([]byte)
	written, err := io.CopyBuffer(w, r, buf)
	buffer32KPool.Put(buf)
	return written, err
}
378783
func (i *Item) Copy() *Item {
	return &Item{
		Key:       i.Key,
		Val:       i.Val,
		Priority:  i.Priority,
		Transient: i.Transient,
	}
}
174280
func (s *Scheme) Copy(src Object) (Object, error) {
	dst, err := s.DeepCopy(src)
	if err != nil {
		return nil, err
	}
	return dst.(Object), nil
}
265899
func (c *Carbon) Copy() *Carbon {
	return create(c.Year(), c.Month(), c.Day(), c.Hour(), c.Minute(), c.Second(), c.Nanosecond(), c.Location())
}
1223286
func (x Vector) Copy() Vector {
	y := make(Vector, len(x))
	copy(y, x)
	return y
}
1304387
func Copy(src reflect.Value) reflect.Value {
	d := make(deepcopy)
	return d.copy(src)
}
1186087
func Copy(w Sender, r Receiver) (int, error) {
	if senderTo, ok := r.(SenderTo); ok {
		if n, err := senderTo.SendTo(w); err != ErrIncompatibleSender {
			return n, err
		}
	}
	if receiverFrom, ok := w.(ReceiverFrom); ok {
		if n, err := receiverFrom.ReceiveFrom(r); err != ErrIncompatibleReceiver {
			return n, err
		}
	}

	var n int
	for {
		var m interface{}
		err := r.Receive(&m)
		if err != nil {
			if err == io.EOF {
				break
			} else {
				return n, err
			}
		}

		err = w.Send(m)
		if err != nil {
			return n, err
		}
		n++
	}
	return n, nil
}
1255420
func (fp *fieldPath) copy() *fieldPath {
	x := fpPool.Get().(*fieldPath)
	copy(x.path, fp.path)
	x.last = fp.last
	x.done = fp.done
	return x
}
1267073
func (l Players) Copy() map[string]*player.Player {
	lc := make(map[string]*player.Player)
	l.RLock()
	for _, p := range l.list {
		lc[p.Name] = p
	}
	l.RUnlock()
	return lc
}
1095676
func (obj *object) Copy() Object {
	cpy, _ := obj.Map(func(k, v *Term) (*Term, *Term, error) {
		return k.Copy(), v.Copy(), nil
	})
	return cpy
}
323682
func (v Vector) Copy() Vector {
	nv := make([]Counter, len(v.Counters))
	copy(nv, v.Counters)
	return Vector{Counters: nv}
}
507994
func (m *MockDatabase) Copy() (state.Database, state.SessionCloser) {
	ret := m.ctrl.Call(m, "Copy")
	ret0, _ := ret[0].(state.Database)
	ret1, _ := ret[1].(state.SessionCloser)
	return ret0, ret1
}
1040683
func Copy(src, dst fs.Filesystem, from, to string) (err error) {
	return withPreparedTarget(dst, from, to, func() error {
		return copyFileContents(src, dst, from, to)
	})
}
187106
func (l *Line) Copy() *Line {
	nl := *l
	nl.Args = make([]string, len(l.Args))
	copy(nl.Args, l.Args)
	if l.Tags != nil {
		nl.Tags = make(map[string]string)
		for k, v := range l.Tags {
			nl.Tags[k] = v
		}
	}
	return &nl
}
1005554
func Clone(b []byte) []byte {
	if b == nil {
		return nil
	}
	buf := make([]byte, len(b))
	copy(buf, b)
	return buf
}