// MarshalText formats a stacktrace Frame as a text string. The output is the
// same as that of fmt.Sprintf("%+v", f), but without newlines or tabs.
347143
func (f Frame) MarshalText() ([]byte, error) {
	name := f.name()
	if name == "unknown" {
		return []byte(name), nil
	}
	return []byte(fmt.Sprintf("%s %s:%d", name, f.file(), f.line())), 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)
}
878650
func (u UUID) MarshalText() (text []byte, err error) {
	text = []byte(u.String())
	return
}
972501
func (w *Word256) Marshal() ([]byte, error) {
	if w == nil {
		return nil, nil
	}
	return w.Bytes(), nil
}
1003186
func MarshalIndent(v interface{}, prefix, indent string) ([]byte, error) {
	return marshalIndent(v, prefix, indent)
}
195489
func (u UUID) MarshalText() ([]byte, error) {
	if len(u) != 16 {
		return nil, nil
	}
	var js [36]byte
	encodeHex(js[:], u)
	return js[:], nil
}
723728
func (b *Board) MarshalText() (text []byte, err error) {
	return []byte(b.String()), nil
}
1039763
func (pos *Position) MarshalText() (text []byte, err error) {
	return []byte(pos.String()), nil
}
66655
func (i *HexOrDecimal256) MarshalText() ([]byte, error) {
	if i == nil {
		return []byte("0x0"), nil
	}
	return []byte(fmt.Sprintf("%#x", (*big.Int)(i))), nil
}
855371
func (t Time) MarshalText() ([]byte, error) {
	return []byte(t.Time.UTC().Format(time.RFC3339Nano)), nil
}
289581
func (i *InstanceID) MarshalText() ([]byte, error) {

	t := &bytes.Buffer{}
	fmt.Fprint(t, i.Driver)
	if len(i.Service) > 0 {
		fmt.Fprintf(t, ":%s", i.Service)
	}
	fmt.Fprintf(t, "=%s", i.ID)

	if len(i.Fields) == 0 && len(i.metadata) == 0 {
		return t.Bytes(), nil
	}

	t.WriteByte(',')

	if len(i.Fields) > 0 {
		vals := url.Values{}
		for k, v := range i.Fields {
			vals.Add(k, v)
		}
		t.WriteString(vals.Encode())
	}

	if len(i.metadata) == 0 {
		return t.Bytes(), nil
	}

	t.WriteByte(',')

	enc := b64.NewEncoder(b64.StdEncoding, t)
	if _, err := enc.Write(i.metadata); err != nil {
		return nil, err
	}
	if err := enc.Close(); err != nil {
		return nil, err
	}
	return t.Bytes(), nil
}
1255417
func (m *Marshaler) MarshalToString(pb proto.Message) (string, error) {
	var buf bytes.Buffer
	if err := m.Marshal(&buf, pb); err != nil {
		return "", err
	}
	return buf.String(), nil
}
1259330
func (j JSONText) MarshalJSON() ([]byte, error) {
	if j == nil {
		return []byte(`null`), nil
	}
	return j, nil
}
373768
func (x StringListExpr) MarshalJSON() ([]byte, error) {
	if x.Func != nil {
		return json.Marshal(x.Func)
	}
	return json.Marshal(x.Literal)
}
3582
func (l Level) MarshalText() ([]byte, error) {
	var t []byte
	switch l {
	case LevelDebug:
		t = levelBytesDebug
	case LevelInfo:
		t = levelBytesInfo
	case LevelWarn:
		t = levelBytesWarn
	case LevelError:
		t = levelBytesError
	case LevelFatal:
		t = levelBytesFatal
	default:
		t = []byte(strconv.FormatInt(int64(l), 10))
	}
	return t, nil
}
1227031
func (af *aggFunction) MarshalJSON() ([]byte, error) {
	buffer := bytes.NewBufferString(fmt.Sprintf("\"%s\"", af))
	return buffer.Bytes(), nil
}
852619
func (a UnprefixedAddress) MarshalText() ([]byte, error) {
	return []byte(hex.EncodeToString(a[:])), nil
}