// MarshalText writes du as a Data URL
484408
func (du *DataURL) MarshalText() ([]byte, error) {
	buf := bytes.NewBuffer(nil)
	if _, err := du.WriteTo(buf); err != nil {
		return nil, err
	}
	return buf.Bytes(), nil
}
400345
func (x Pol) MarshalJSON() ([]byte, error) {
	buf := strconv.AppendUint([]byte{'"'}, uint64(x), 16)
	buf = append(buf, '"')
	return buf, nil
}
542520
func (id ID) MarshalJSON() ([]byte, error) {
	if id.IsNil() {
		return []byte("null"), nil
	}
	text := make([]byte, encodedLen+2)
	encode(text[1:encodedLen+1], id[:])
	text[0], text[encodedLen+1] = '"', '"'
	return text, nil
}
859030
func (c *TextComponent) MarshalJSON() ([]byte, error) {
	return json.Marshal(&struct {
		Type    FlexComponentType        `json:"type"`
		Text    string                   `json:"text"`
		Flex    *int                     `json:"flex,omitempty"`
		Margin  FlexComponentMarginType  `json:"margin,omitempty"`
		Size    FlexTextSizeType         `json:"size,omitempty"`
		Align   FlexComponentAlignType   `json:"align,omitempty"`
		Gravity FlexComponentGravityType `json:"gravity,omitempty"`
		Wrap    bool                     `json:"wrap,omitempty"`
		Weight  FlexTextWeightType       `json:"weight,omitempty"`
		Color   string                   `json:"color,omitempty"`
		Action  TemplateAction           `json:"action,omitempty"`
	}{
		Type:    FlexComponentTypeText,
		Text:    c.Text,
		Flex:    c.Flex,
		Margin:  c.Margin,
		Size:    c.Size,
		Align:   c.Align,
		Gravity: c.Gravity,
		Wrap:    c.Wrap,
		Weight:  c.Weight,
		Color:   c.Color,
		Action:  c.Action,
	})
}
958389
func (m *Marshaler) marshalField(out *errWriter, prop *proto.Properties, v reflect.Value, indent string) error {
	if m.Indent != "" {
		out.write(indent)
		out.write(m.Indent)
	}
	out.write(`"`)
	out.write(prop.JSONName)
	out.write(`":`)
	if m.Indent != "" {
		out.write(" ")
	}
	if err := m.marshalValue(out, prop, v, indent); err != nil {
		return err
	}
	return nil
}
175892
func (m GatewayIDMetadata) MarshalText() ([]byte, error) {
	return []byte(fmt.Sprintf("GatewayID %s", m.GatewayID)), nil
}
1061427
func (o *Object) MarshalJSON() ([]byte, error) {
	ctx := _builtinJSON_stringifyContext{
		r: o.runtime,
	}
	ex := o.runtime.vm.try(func() {
		if !ctx.do(o) {
			ctx.buf.WriteString("null")
		}
	})
	if ex != nil {
		return nil, ex
	}
	return ctx.buf.Bytes(), nil
}
200319
func (prefix DevAddrPrefix) MarshalTo(b []byte) (int, error) {
	copy(b, prefix.Bytes())
	return 4, 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
}
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)
}
72251
func CompactTextString(pb Message) string {
	var buf bytes.Buffer
	marshalText(&buf, pb, true)
	return buf.String()
}
233839
func (c Code) MarshalText() ([]byte, error) {
	s, ok := _codeToString[c]
	if ok {
		return []byte(s), nil
	}
	return nil, fmt.Errorf("unknown code: %d", int(c))
}
1146324
func (x *Big) MarshalText() ([]byte, error) {
	if debug {
		x.validate()
	}
	if x == nil {
		return []byte("<nil>"), nil
	}
	var (
		b = new(bytes.Buffer)
		f = formatter{w: b, prec: x.Precision(), width: noWidth}
		e = sciE[x.Context.OperatingMode]
	)
	b.Grow(x.Precision())
	f.format(x, normal, e)
	return b.Bytes(), nil
}
861505
func (u Array) MarshalText() ([]byte, error) {
	var js [36]byte
	encodeHex(js[:], u[:])
	return js[:], 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
}
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
}
852619
func (a UnprefixedAddress) MarshalText() ([]byte, error) {
	return []byte(hex.EncodeToString(a[:])), nil
}