// MarshalText decodes a ResourceID from a flat string; this is
// required because ResourceIDs are sometimes used as map keys.
973210
func (id *ResourceID) UnmarshalText(text []byte) error {
	result, err := ParseResourceID(string(text))
	if err != nil {
		return err
	}
	*id = result
	return nil
}
195489
func (u UUID) MarshalText() ([]byte, error) {
	if len(u) != 16 {
		return nil, nil
	}
	var js [36]byte
	encodeHex(js[:], u)
	return js[:], nil
}
1348857
func (t TextErr) MarshalText() ([]byte, error) {
	return []byte(t.Err.Error()), nil
}
671776
func (id ResourceID) MarshalJSON() ([]byte, error) {
	if id.resourceIDImpl == nil {
		// Sadly needed as it's possible to construct an empty ResourceID literal
		return json.Marshal("")
	}
	return json.Marshal(id.String())
}
1052568
func (pe *PolicyEffect) MarshalText() ([]byte, error) {
	if *pe {
		return []byte("allow"), nil
	}
	return []byte("deny"), nil
}
1142562
func (s DLSettings) MarshalText() ([]byte, error) {
	b, err := s.MarshalBinary()
	if err != nil {
		return nil, err
	}

	return []byte(hex.EncodeToString(b)), 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
}
878650
func (u UUID) MarshalText() (text []byte, err error) {
	text = []byte(u.String())
	return
}
69610
func (l *LocalDevices) MarshalText() ([]byte, error) {

	t := &bytes.Buffer{}
	fmt.Fprintf(t, "%s=", l.Driver)

	keys := []string{}

	for k := range l.DeviceMap {
		keys = append(keys, k)
	}

	sort.Sort(byString(keys))

	for _, k := range keys {
		fmt.Fprintf(t, "%s::%s,", k, l.DeviceMap[k])
	}

	if len(l.DeviceMap) > 0 {
		t.Truncate(t.Len() - 1)
	}

	return t.Bytes(), nil
}
12827
func MarshalTextString(pb Message) string {
	var buf bytes.Buffer
	marshalText(&buf, pb, false)
	return buf.String()
}
1039763
func (pos *Position) MarshalText() (text []byte, err error) {
	return []byte(pos.String()), nil
}
1173850
func (id ID) MarshalText() ([]byte, error) {
	text := make([]byte, encodedLen)
	encode(text, id[:])
	return text, nil
}
523025
func (e *pluginError) MarshalText() (text []byte, err error) {
	return []byte(e.cause.Error()), nil
}
330244
func (resource *Composition) MarshalJSON() ([]byte, error) {
	resource.ResourceType = "Composition"
	// Dereferencing the pointer to avoid infinite recursion.
	// Passing in plain old x (a pointer to Composition), would cause this same
	// MarshallJSON function to be called again
	return json.Marshal(*resource)
}
1222470
func (resource *Questionnaire) MarshalJSON() ([]byte, error) {
	resource.ResourceType = "Questionnaire"
	// Dereferencing the pointer to avoid infinite recursion.
	// Passing in plain old x (a pointer to Questionnaire), would cause this same
	// MarshallJSON function to be called again
	return json.Marshal(*resource)
}
66655
func (i *HexOrDecimal256) MarshalText() ([]byte, error) {
	if i == nil {
		return []byte("0x0"), nil
	}
	return []byte(fmt.Sprintf("%#x", (*big.Int)(i))), nil
}
687967
func (resource *Group) MarshalJSON() ([]byte, error) {
	resource.ResourceType = "Group"
	// Dereferencing the pointer to avoid infinite recursion.
	// Passing in plain old x (a pointer to Group), would cause this same
	// MarshallJSON function to be called again
	return json.Marshal(*resource)
}