// SerializeTo implements the Data interface.
556059
func (t *Field) SerializeTo(w io.Writer) error {
	b := make([]byte, len(t.Data)+4)
	binary.BigEndian.PutUint16(b[0:2], uint16(t.Tag))
	binary.BigEndian.PutUint16(b[2:4], uint16(len(t.Data)))
	copy(b[4:], t.Data)

	_, err := w.Write(b)
	return err
}
706503
func Serialize(data interface{}) (bytes []byte, err error) {
	switch data.(type) {
	case []byte:
		return data.([]byte), nil
	case string:
		return []byte(data.(string)), nil
	default:
		if data != nil {
			return []byte(fmt.Sprint(data)), nil
		}
	}
	return nil, nil
}
858170
func (dsl *DestSmeList) SerializeTo(w io.Writer) error {
	_, err := w.Write(dsl.Bytes())
	return err
}
819751
func (t *TxOut) SerializeSize() int {
	// Value 8 bytes + serialized varint size for the length of PkScript +
	// PkScript bytes.
	return 8 + VarIntSerializeSize(uint64(len(t.PkScript))) + len(t.PkScript)
}
1131540
func (prof *Profiler) Serialize(up u.Uptime) ([]byte, error) {
	return json.Marshal(up)
}
451308
func Serialize(v interface{}, simple bool) []byte {
	return NewWriter(simple).Serialize(v).Bytes()
}
1089159
func (a *AggregateStatsRequest) WriteTo(w io.Writer) (int64, error) {
	return encoding.WriteTo(w, a.Table, pad3{},
		a.OutPort, a.OutGroup, pad4{}, a.Cookie,
		a.CookieMask, &a.Match)
}
389794
func (b *ByteBuffer) WriteTo(w io.Writer) (int64, error) {
	n, err := w.Write(b.B)
	return int64(n), err
}
1238957
func (p *PortStatsRequest) WriteTo(w io.Writer) (int64, error) {
	return encoding.WriteTo(w, p.PortNo, pad4{})
}
840020
func (b *Buffer) DumpTo(w io.Writer) (written int, err error) {
	var n int
	for _, buf := range b.bufs {
		if err == nil {
			n, err = w.Write(buf)
			written += n
		}
		putBuf(buf)
	}

	if err == nil {
		n, err = w.Write(b.Buf)
		written += n
	}
	putBuf(b.toPool)

	b.bufs = nil
	b.Buf = nil
	b.toPool = nil

	return
}
58055
func (p *PortStatus) WriteTo(w io.Writer) (int64, error) {
	return encoding.WriteTo(w, p.Reason, pad7{}, &p.Port)
}
588048
func (v *Variable) SerializeTo(w io.Writer) error {
	_, err := w.Write(v.Bytes())
	return err
}
70048
func (i *InstructionWriteMetadata) WriteTo(w io.Writer) (int64, error) {
	return encoding.WriteTo(w, instruction{i.Type(), 24},
		pad4{}, i.Metadata, i.MetadataMask)
}
612349
func (m *Time) MarshalTo(data []byte) (int, error) {
	return m.ProtoTime().MarshalTo(data)
}
718676
func (c *Config) WriteTo(w io.Writer) (int64, error) {
	return 0, toml.NewEncoder(w).Encode(c)
}
75773
func (e *Error) WriteTo(w io.Writer) (int64, error) {
	return encoding.WriteTo(w, e.Type, e.Code, e.Data)
}
510144
func (rs *RoundStateSimple) MarshalTo(data []byte) (int, error) {
	bs, err := rs.Marshal()
	if err != nil {
		return -1, err
	}
	return copy(data, bs), nil
}