// WriteTo is the same as bytes.Buffer.WriteTo.
339806
func (b *Buffer) WriteTo(w io.Writer) (int64, error) {
	version := b.preOp()
	n, err := b.buf.WriteTo(w)
	b.postOp(version)
	return n, err
}
1172198
func (sel *selector) WriteTo(w io.Writer) (int64, error) {
	return sel.writeTo(w, nil)
}
1205744
func (m *MeterBandStats) WriteTo(w io.Writer) (int64, error) {
	return encoding.WriteTo(w, m.PacketBandCount, m.ByteBandCount)
}
752407
func (a *ActionSetNetworkTTL) WriteTo(w io.Writer) (int64, error) {
	return encoding.WriteTo(w, action{a.Type(), actionLen}, a.TTL, pad3{})
}
860708
func (b Bool) WriteTo(w io.Writer) (int64, error) {
	written, err := fmt.Fprintf(w, "%t", b)
	return int64(written), err
}
81525
func (q *QueueStatsRequest) WriteTo(w io.Writer) (int64, error) {
	return encoding.WriteTo(w, q.Port, q.Queue)
}
1321291
func (i *InstructionGotoTable) WriteTo(w io.Writer) (int64, error) {
	return encoding.WriteTo(w, instruction{i.Type(), 8}, i.Table, pad3{})
}
765087
func (s *Chan) WriteTo(w io.Writer) {
	// new buffer per message
	// if bottleneck, cycle around a set of buffers
	mw := NewWriter(w)

	// single writer, no need for Mutex
	mw.(*writer).lock = new(nullLocker)
Loop:
	for {
		select {
		case <-s.CloseChan:
			break Loop // told we're done

		case msg, ok := <-s.MsgChan:
			if !ok { // chan closed
				break Loop
			}

			if err := mw.WriteMsg(msg); err != nil {
				if err != io.EOF {
					// unexpected error. tell the client.
					s.ErrChan <- err
				}

				break Loop
			}
		}
	}

	// signal we're done
	s.CloseChan <- true
}
718676
func (c *Config) WriteTo(w io.Writer) (int64, error) {
	return 0, toml.NewEncoder(w).Encode(c)
}
988670
func (a *Actions) WriteTo(w io.Writer) (int64, error) {
	buf, err := a.bytes()
	if err != nil {
		return int64(len(buf)), err
	}

	return encoding.WriteTo(w, buf)
}
373751
func (v ByteView) WriteTo(w io.Writer) (n int64, err error) {
	var m int
	if v.b != nil {
		m, err = w.Write(v.b)
	} else {
		m, err = io.WriteString(w, v.s)
	}
	if err == nil && m < v.Len() {
		err = io.ErrShortWrite
	}
	n = int64(m)
	return
}
1106630
func (s String) WriteTo(w Writer) error {
	return ByteSlice(s).WriteTo(w)
}
785910
func (m *Image) WriteTo(w io.Writer) (int64, error) {
	n, err := w.Write(m.encodedPNG())
	return int64(n), err
}
75773
func (e *Error) WriteTo(w io.Writer) (int64, error) {
	return encoding.WriteTo(w, e.Type, e.Code, e.Data)
}
783158
func (dec *declaration) WriteTo(w io.Writer) (int64, error) {
	return dec.writeTo(w, nil)
}
1360615
func (r *AccessLogRecord) WriteTo(w io.Writer) (int64, error) {
	bytesWritten, err := w.Write(r.getRecord())
	return int64(bytesWritten), err
}
294999
func (e *End) WriteTo(w io.Writer) (n int64, err error) {
	var tid byte

	err = binary.Write(w, binary.BigEndian, &tid)
	if err != nil {
		return
	}
	n = 1
	return
}