// MarshalList is an alias for Marshal func which marshals Go value
// type to a slice of AttributeValues.
771968
func MarshalList(in interface{}) ([]*dynamodb.AttributeValue, error) {
	av, err := NewEncoder().Encode(in)
	if err != nil || av == nil || av.L == nil {
		return []*dynamodb.AttributeValue{}, err
	}

	return av.L, nil
}
1083557
func (p *PooledMarshaller) Marshal(obj interface{}) ([]byte, error) {
	m := p.pool.Get().(*Marshaller)
	bts, err := m.Marshal(obj)
	p.pool.Put(m)
	return bts, err
}
1053949
func (l CFList) MarshalBinary() ([]byte, error) {
	out := make([]byte, 16)

	b, err := l.Payload.MarshalBinary()
	if err != nil {
		return nil, err
	}
	copy(out, b)
	out[15] = byte(l.CFListType)

	return out, nil
}
690591
func (resource *NamingSystem) MarshalJSON() ([]byte, error) {
	resource.ResourceType = "NamingSystem"
	// Dereferencing the pointer to avoid infinite recursion.
	// Passing in plain old x (a pointer to NamingSystem), would cause this same
	// MarshallJSON function to be called again
	return json.Marshal(*resource)
}
938090
func (prof *Profiler) Marshal(nodes *numa.Nodes) ([]byte, error) {
	return prof.Serialize(nodes)
}
345240
func (resource *StructureDefinition) MarshalJSON() ([]byte, error) {
	resource.ResourceType = "StructureDefinition"
	// Dereferencing the pointer to avoid infinite recursion.
	// Passing in plain old x (a pointer to StructureDefinition), would cause this same
	// MarshallJSON function to be called again
	return json.Marshal(*resource)
}
501918
func (a *aggContainer) MarshalJSON() ([]byte, error) {
	root := map[string]interface{}{
		a.Type: a.Aggregation,
	}

	if len(a.Aggs) > 0 {
		root["aggs"] = a.Aggs
	}

	return json.Marshal(root)
}
889377
func valueMarshaler(t reflect.Type) marshaler {
	if zm, ok := reflect.Zero(reflect.PtrTo(t)).Interface().(Marshaler); ok {
		return dynamicMarshaler{
			marshal: func(v reflect.Value, s string) error {
				return v.Addr().Interface().(Marshaler).Marshal(s)
			},
			explicitValueRequired: zm.RequiresExplicitValue(),
		}
	}
	if bm, ok := builtinMarshalers[t]; ok {
		return bm
	}
	switch t.Kind() {
	case reflect.Ptr:
		m := valueMarshaler(t.Elem())
		if m == nil {
			return nil
		}
		return ptrMarshaler{m}
	case reflect.Struct:
		return nil
	case reflect.Bool:
		return dynamicMarshaler{
			marshal: func(v reflect.Value, s string) error {
				if s == "" {
					v.SetBool(true)
					return nil
				}
				b, err := strconv.ParseBool(s)
				v.SetBool(b)
				return err
			},
			explicitValueRequired: false,
		}
	}
	return defaultMarshaler{}
}
1255765
func (r *RequestSetattrV2) MarshalBinary() ([]byte, error) {
	return MarshalBinary(&r.Request, &r.Hints, &r.Attr, &r.Handle, &r.FileName)
}
382643
func (resource *List) MarshalJSON() ([]byte, error) {
	resource.ResourceType = "List"
	// Dereferencing the pointer to avoid infinite recursion.
	// Passing in plain old x (a pointer to List), would cause this same
	// MarshallJSON function to be called again
	return json.Marshal(*resource)
}
522415
func MarshalJSON(v interface{}) ([]byte, error) {
	val, _, err := marshalValue(reflect.ValueOf(v), reflect.StructField{
		Tag: `json:",wrapper"`,
	})
	if err != nil {
		return nil, err
	}
	return json.Marshal(val)
}
1269400
func Marshal(object interface{}) (data string, err error) {
	if t, err := json.Marshal(object); err != nil {
		data = ""
	} else {
		data = string(t)
	}
	return
}
1047457
func (b *BoolWrapper) MarshalXMLAttr(name xml.Name) (xml.Attr, error) {
	val := "False"
	if *b {
		val = "True"
	}

	return xml.Attr{Name: name, Value: val}, nil
}
937093
func (r *RequestGetattrV2) MarshalBinary() ([]byte, error) {
	return MarshalBinary(&r.Request, &r.AttrHint, &r.Handle, &r.FileName)
}
151703
func (v mvccValue) MarshalBinary() ([]byte, error) {
	var (
		mh  marshalHelper
		buf bytes.Buffer
	)
	mh.WriteNumber(&buf, int64(v.valueType))
	mh.WriteNumber(&buf, v.startTS)
	mh.WriteNumber(&buf, v.commitTS)
	mh.WriteSlice(&buf, v.value)
	return buf.Bytes(), errors.Trace(mh.err)
}
972843
func (r itemCategory) MarshalJSON() ([]byte, error) {
	if s, ok := interface{}(r).(fmt.Stringer); ok {
		return json.Marshal(s.String())
	}
	s, ok := _itemCategoryValueToName[r]
	if !ok {
		return nil, fmt.Errorf("invalid itemCategory: %d", r)
	}
	return json.Marshal(s)
}
187243
func (resource *ValueSet) MarshalJSON() ([]byte, error) {
	resource.ResourceType = "ValueSet"
	// Dereferencing the pointer to avoid infinite recursion.
	// Passing in plain old x (a pointer to ValueSet), would cause this same
	// MarshallJSON function to be called again
	return json.Marshal(*resource)
}