// MarshalText implements the encoding.TextMarshaler interface
175892
func (m GatewayIDMetadata) MarshalText() ([]byte, error) {
	return []byte(fmt.Sprintf("GatewayID %s", m.GatewayID)), nil
}
222734
func (m RawMessage) MarshalJSON() ([]byte, error) {
	if m == nil {
		return []byte("null"), nil
	}
	return m, nil
}
1142562
func (s DLSettings) MarshalText() ([]byte, error) {
	b, err := s.MarshalBinary()
	if err != nil {
		return nil, err
	}

	return []byte(hex.EncodeToString(b)), nil
}
972501
func (w *Word256) Marshal() ([]byte, error) {
	if w == nil {
		return nil, nil
	}
	return w.Bytes(), nil
}
878650
func (u UUID) MarshalText() (text []byte, err error) {
	text = []byte(u.String())
	return
}
1319967
func MarshalString(g orb.Geometry) string {
	buf := bytes.NewBuffer(nil)

	wkt(buf, g)
	return buf.String()
}
1305199
func (bh *Header) MarshalText() ([]byte, error) {
	var buf bytes.Buffer
	if bh.Version != "" {
		if bh.GroupOrder == GroupUnspecified {
			fmt.Fprintf(&buf, "@HD\tVN:%s\tSO:%s", bh.Version, bh.SortOrder)
		} else {
			fmt.Fprintf(&buf, "@HD\tVN:%s\tSO:%s\tGO:%s", bh.Version, bh.SortOrder, bh.GroupOrder)
		}
		for _, tp := range bh.otherTags {
			fmt.Fprintf(&buf, "\t%s:%s", tp.tag, tp.value)
		}
		buf.WriteByte('\n')
	}
	for _, r := range bh.refs {
		fmt.Fprintf(&buf, "%s\n", r)
	}
	for _, rg := range bh.rgs {
		fmt.Fprintf(&buf, "%s\n", rg)
	}
	for _, p := range bh.progs {
		fmt.Fprintf(&buf, "%s\n", p)
	}
	for _, co := range bh.Comments {
		fmt.Fprintf(&buf, "@CO\t%s\n", co)
	}
	return buf.Bytes(), nil
}
1093131
func (t Timestamp) MarshalText() (text []byte, err error) {
	text = []byte(strconv.Itoa(int(t.UTC().Unix())))
	return
}
902544
func (o UUID) MarshalText() ([]byte, error) {
	f := FormatCanonical
	if defaultFormats[printFormat] {
		f = printFormat
	}
	return []byte(formatUuid(o.Bytes(), f)), nil
}
786384
func (m *Marshaler) Marshal(out io.Writer, pb proto.Message) error {
	writer := &errWriter{writer: out}
	return m.marshalObject(writer, pb, "")
}
656034
func (tm *TextMarshaler) Text(pb Message) string {
	var buf bytes.Buffer
	tm.Marshal(&buf, pb)
	return buf.String()
}
353977
func (i HexOrDecimal64) MarshalText() ([]byte, error) {
	return []byte(fmt.Sprintf("%#x", uint64(i))), nil
}
338427
func (u UUID) MarshalText() ([]byte, error) {
	/* Inlined UUID.String() implementation, cannot reuse the one from
	   UUID.String() as that cast will force an additional memory
	   allocation because current version the compiler (go 1.3.1) cannot
	   realize that the data pointer of the result of the UUID.String() call
	   can be moved to the byte-slice return. Speed difference from inlining
	   is about +20% */
	/* Equivalent code:
	   return []byte(u.String()), nil */
	/* NOTE: If this is changed, also look at the following methods:
	   UUID.MarshalJSON() and UUID.String() */
	b := [36]byte{}

	for i, n := range []int{
		0, 2, 4, 6,
		9, 11,
		14, 16,
		19, 21,
		24, 26, 28, 30, 32, 34,
	} {
		b[n] = halfbyte2hexchar[(u[i]>>4)&0x0f]
		b[n+1] = halfbyte2hexchar[u[i]&0x0f]
	}

	b[8] = '-'
	b[13] = '-'
	b[18] = '-'
	b[23] = '-'

	return b[:], nil
}
1069693
func (p *printer) marshalTextInterface(val encoding.TextMarshaler, start StartElement) error {
	if err := p.writeStart(&start); err != nil {
		return err
	}
	text, err := val.MarshalText()
	if err != nil {
		return err
	}
	EscapeText(p, text)
	return p.writeEnd(start.Name)
}
421641
func (m PrefixMetadata) MarshalText() ([]byte, error) {
	return []byte(fmt.Sprintf("Prefix %s", m.Prefix)), nil
}
1302956
func MarshalString(in interface{}) (out string, err error) {
	bufferString := bytes.NewBufferString(out)
	if err := Marshal(in, bufferString); err != nil {
		return "", err
	}
	return bufferString.String(), nil
}
640789
func (f Field) MarshalText() (p []byte, err error) {
	return []byte(f.reference.String()), nil
}