// Marshal mocks base method
166316
func (m *MockSerializer) Marshal(arg0 interface{}) ([]byte, error) {
	ret := m.ctrl.Call(m, "Marshal", arg0)
	ret0, _ := ret[0].([]byte)
	ret1, _ := ret[1].(error)
	return ret0, ret1
}
317553
func (*ProtoMarshaller) Marshal(value interface{}) ([]byte, error) {
	message, ok := value.(proto.Message)
	if !ok {
		return nil, errors.New("unable to marshal non proto field")
	}
	return proto.Marshal(message)
}
552222
func (prof *Profiler) Marshal(inf *basic.Info) ([]byte, error) {
	return prof.Serialize(inf)
}
1198857
func (pvt *PvtDataCollections) Marshal() ([][]byte, error) {
	pvtDataBytes := make([][]byte, 0)
	for index, each := range *pvt {
		if each == nil {
			errMsg := fmt.Sprintf("Mallformed private data payload, rwset index %d is nil", index)
			return nil, errors.New(errMsg)
		}
		pvtBytes, err := proto.Marshal(each.WriteSet)
		if err != nil {
			errMsg := fmt.Sprintf("Could not marshal private rwset index %d, due to %s", index, err)
			return nil, errors.New(errMsg)
		}
		// Compose gossip protobuf message with private rwset + index of transaction in the block
		txSeqInBlock := each.SeqInBlock
		pvtDataPayload := &gossip.PvtDataPayload{TxSeqInBlock: txSeqInBlock, Payload: pvtBytes}
		payloadBytes, err := proto.Marshal(pvtDataPayload)
		if err != nil {
			errMsg := fmt.Sprintf("Could not marshal private payload with transaction index %d, due to %s", txSeqInBlock, err)
			return nil, errors.New(errMsg)
		}

		pvtDataBytes = append(pvtDataBytes, payloadBytes)
	}
	return pvtDataBytes, nil
}
1053695
func Marshal(data interface{}) ([]byte, error) {
	enc := NewEncoder(nil)
	enc.Encode(data)
	return enc.Bytes(), enc.Error()
}
1179299
func (m *Time) Marshal() (data []byte, err error) {
	return m.ProtoTime().Marshal()
}
1226948
func (b *Builder) Marshal(w io.Writer) error {
	var nodeType lowring.Node
	j := &builderJSON{
		MarshalVersion:              0,
		NodeType:                    int(unsafe.Sizeof(nodeType)) * 8,
		ReplicaCount:                len(b.ring.ReplicaToPartitionToNode),
		PartitionCount:              len(b.ring.ReplicaToPartitionToNode[0]),
		Nodes:                       make([]*builderNodeJSON, len(b.nodes)),
		Groups:                      make([]*builderGroupJSON, len(b.groups)),
		MaxPartitionCount:           b.ring.MaxPartitionCount,
		Rebalanced:                  b.ring.Rebalanced.UnixNano(),
		ReassignmentWait:            int(b.ring.ReassignmentWait),
		MaxReplicaReassignableCount: int(b.ring.MaxReplicaReassignableCount),
	}
	for i, n := range b.nodes {
		j.Nodes[i] = &builderNodeJSON{
			Info:     n.info,
			Capacity: b.ring.NodeToCapacity[n.index],
			Group:    b.ring.NodeToGroup[n.index],
		}
	}
	for i, g := range b.groups {
		j.Groups[i] = &builderGroupJSON{
			Info:   g.info,
			Parent: b.ring.GroupToGroup[g.index],
		}
	}
	if err := json.NewEncoder(w).Encode(j); err != nil {
		return err
	}
	// This 0 byte is written as a preface to the raw ring data and will let
	// the unmarshaler get past any trailing whitespace, newlines, etc. that
	// the JSON encoder may or may not have written.
	if _, err := w.Write([]byte{0}); err != nil {
		return err
	}
	for _, partitionToNode := range b.ring.ReplicaToPartitionToNode {
		if err := binary.Write(w, binary.LittleEndian, partitionToNode); err != nil {
			return err
		}
	}
	for _, partitionToWait := range b.ring.ReplicaToPartitionToWait {
		if err := binary.Write(w, binary.LittleEndian, partitionToWait); err != nil {
			return err
		}
	}
	return nil
}
1104259
func (p *icmpEcho) Marshal() ([]byte, error) {
	b := make([]byte, 4+len(p.Data))
	b[0], b[1] = byte(p.ID>>8), byte(p.ID&0xff)
	b[2], b[3] = byte(p.Seq>>8), byte(p.Seq&0xff)
	copy(b[4:], p.Data)
	return b, nil
}
770568
func Marshal(v interface{}) ([]byte, error) {
	if u, ok := v.(Marshaler); ok {
		return u.MarshalURL()
	}

	rv := reflect.ValueOf(v)
	if rv == zeroval {
		return nil, errors.New("can not unmarshal into a nil value")
	}

	// This better be a pointer
	switch rv.Kind() {
	case reflect.Ptr, reflect.Interface:
		// Get the value beyond the pointer
		rv = rv.Elem()
	}

	switch rv.Kind() {
	case reflect.Map:
		if kk := rv.Type().Key().Kind(); kk != reflect.String {
			return nil, errors.New("urlenc.Marshal: map key must be string type (Kind: " + kk.String() + ")")
		}
		return marshalMap(rv)
	case reflect.Struct:
		return marshalStruct(rv)
	default:
		return nil, errors.New("urlenc.Marshal: unsupported type (" + rv.Type().String() + ")")
	}
}
611547
func Marshal(v interface{}) ([]byte, error) {
	var buf bytes.Buffer
	e := Encoder{w: &buf}
	err := e.Encode(v)
	if err != nil {
		return nil, err
	}
	return buf.Bytes(), nil
}
997033
func (r Raw) Marshal() ([]byte, error) {
	if len(r) == 0 {
		return nil, nil
	}
	return []byte(r), nil
}
198421
func (c *Config) Marshal() ([]byte, error) {
	c.marshalCore()
	c.marshalPack()
	c.marshalRemotes()
	c.marshalSubmodules()
	c.marshalBranches()

	buf := bytes.NewBuffer(nil)
	if err := format.NewEncoder(buf).Encode(c.Raw); err != nil {
		return nil, err
	}

	return buf.Bytes(), nil
}
1165777
func Marshal(g geom.T) ([]byte, error) {
	geojson, err := Encode(g)
	if err != nil {
		return nil, err
	}
	return json.Marshal(geojson)
}
1279529
func (prof *Profiler) Marshal(la l.LoadAvg) ([]byte, error) {
	return prof.Serialize(la)
}
1367058
func Marshal(val interface{}) string {
	b, err := xml.Marshal(val)
	if err != nil {
		panic(err)
	}
	return string(b)
}
482153
func (p *StateInitializationParams) Marshal() ([]byte, error) {
	customImageMetadataJSON, err := json.Marshal(p.CustomImageMetadata)
	if err != nil {
		return nil, errors.Annotate(err, "marshalling custom image metadata")
	}
	controllerCloud, err := cloud.MarshalCloud(p.ControllerCloud)
	if err != nil {
		return nil, errors.Annotate(err, "marshalling cloud definition")
	}
	internal := stateInitializationParamsInternal{
		p.ControllerConfig,
		p.ControllerModelConfig.AllAttrs(),
		p.ControllerModelEnvironVersion,
		p.ControllerInheritedConfig,
		p.RegionInheritedConfig,
		p.HostedModelConfig,
		p.BootstrapMachineInstanceId,
		p.BootstrapMachineConstraints,
		p.BootstrapMachineHardwareCharacteristics,
		p.ModelConstraints,
		string(customImageMetadataJSON),
		string(controllerCloud),
		p.ControllerCloudRegion,
		p.ControllerCloudCredentialName,
		p.ControllerCloudCredential,
	}
	return yaml.Marshal(&internal)
}
25785
func (c protobufCodec) Marshal(v interface{}) ([]byte, error) {
	message, ok := v.(proto.Message)
	if !ok {
		// toBytes() may need to encode non-protobuf type, if that occurs use json
		return json.Codec.Marshal(v)
	}
	return proto.Marshal(message)
}