// Code generated by github.com/tinylib/msgp DO NOT EDIT.

package tracer

import (
	"github.com/tinylib/msgp/msgp"
)

// DecodeMsg implements msgp.Decodable
// +checklocksignore — Generated code: post-finish serialization or pre-share deserialization.
func (z *Span) DecodeMsg(dc *msgp.Reader) (err error) {
	var field []byte
	_ = field
	var zb0001 uint32
	zb0001, err = dc.ReadMapHeader()
	if err != nil {
		err = msgp.WrapError(err)
		return
	}
	for zb0001 > 0 {
		zb0001--
		field, err = dc.ReadMapKeyPtr()
		if err != nil {
			err = msgp.WrapError(err)
			return
		}
		switch msgp.UnsafeString(field) {
		case "name":
			z.name, err = dc.ReadString()
			if err != nil {
				err = msgp.WrapError(err, "name")
				return
			}
		case "service":
			z.service, err = dc.ReadString()
			if err != nil {
				err = msgp.WrapError(err, "service")
				return
			}
		case "resource":
			z.resource, err = dc.ReadString()
			if err != nil {
				err = msgp.WrapError(err, "resource")
				return
			}
		case "type":
			z.spanType, err = dc.ReadString()
			if err != nil {
				err = msgp.WrapError(err, "spanType")
				return
			}
		case "start":
			z.start, err = dc.ReadInt64()
			if err != nil {
				err = msgp.WrapError(err, "start")
				return
			}
		case "duration":
			z.duration, err = dc.ReadInt64()
			if err != nil {
				err = msgp.WrapError(err, "duration")
				return
			}
		case "meta":
			var zb0002 uint32
			zb0002, err = dc.ReadMapHeader()
			if err != nil {
				err = msgp.WrapError(err, "meta")
				return
			}
			if z.meta == nil {
				z.meta = make(map[string]string, zb0002)
			} else if len(z.meta) > 0 {
				clear(z.meta)
			}
			for zb0002 > 0 {
				zb0002--
				var za0001 string
				za0001, err = dc.ReadString()
				if err != nil {
					err = msgp.WrapError(err, "meta")
					return
				}
				var za0002 string
				za0002, err = dc.ReadString()
				if err != nil {
					err = msgp.WrapError(err, "meta", za0001)
					return
				}
				z.meta[za0001] = za0002
			}
		case "meta_struct":
			err = z.metaStruct.DecodeMsg(dc)
			if err != nil {
				err = msgp.WrapError(err, "metaStruct")
				return
			}
		case "metrics":
			var zb0003 uint32
			zb0003, err = dc.ReadMapHeader()
			if err != nil {
				err = msgp.WrapError(err, "metrics")
				return
			}
			if z.metrics == nil {
				z.metrics = make(map[string]float64, zb0003)
			} else if len(z.metrics) > 0 {
				clear(z.metrics)
			}
			for zb0003 > 0 {
				zb0003--
				var za0003 string
				za0003, err = dc.ReadString()
				if err != nil {
					err = msgp.WrapError(err, "metrics")
					return
				}
				var za0004 float64
				za0004, err = dc.ReadFloat64()
				if err != nil {
					err = msgp.WrapError(err, "metrics", za0003)
					return
				}
				z.metrics[za0003] = za0004
			}
		case "span_id":
			z.spanID, err = dc.ReadUint64()
			if err != nil {
				err = msgp.WrapError(err, "spanID")
				return
			}
		case "trace_id":
			z.traceID, err = dc.ReadUint64()
			if err != nil {
				err = msgp.WrapError(err, "traceID")
				return
			}
		case "parent_id":
			z.parentID, err = dc.ReadUint64()
			if err != nil {
				err = msgp.WrapError(err, "parentID")
				return
			}
		case "error":
			z.error, err = dc.ReadInt32()
			if err != nil {
				err = msgp.WrapError(err, "error")
				return
			}
		case "span_links":
			var zb0004 uint32
			zb0004, err = dc.ReadArrayHeader()
			if err != nil {
				err = msgp.WrapError(err, "spanLinks")
				return
			}
			if cap(z.spanLinks) >= int(zb0004) {
				z.spanLinks = (z.spanLinks)[:zb0004]
			} else {
				z.spanLinks = make([]SpanLink, zb0004)
			}
			for za0005 := range z.spanLinks {
				err = z.spanLinks[za0005].DecodeMsg(dc)
				if err != nil {
					err = msgp.WrapError(err, "spanLinks", za0005)
					return
				}
			}
		case "span_events":
			var zb0005 uint32
			zb0005, err = dc.ReadArrayHeader()
			if err != nil {
				err = msgp.WrapError(err, "spanEvents")
				return
			}
			if cap(z.spanEvents) >= int(zb0005) {
				z.spanEvents = (z.spanEvents)[:zb0005]
			} else {
				z.spanEvents = make([]spanEvent, zb0005)
			}
			for za0006 := range z.spanEvents {
				err = z.spanEvents[za0006].DecodeMsg(dc)
				if err != nil {
					err = msgp.WrapError(err, "spanEvents", za0006)
					return
				}
			}
		default:
			err = dc.Skip()
			if err != nil {
				err = msgp.WrapError(err)
				return
			}
		}
	}
	return
}

// EncodeMsg implements msgp.Encodable
// +checklocksignore — Generated code: post-finish serialization or pre-share deserialization.
func (z *Span) EncodeMsg(en *msgp.Writer) (err error) {
	// check for omitted fields
	zb0001Len := uint32(15)
	var zb0001Mask uint16 /* 15 bits */
	_ = zb0001Mask
	if z.meta == nil {
		zb0001Len--
		zb0001Mask |= 0x40
	}
	if z.metrics == nil {
		zb0001Len--
		zb0001Mask |= 0x100
	}
	if z.spanLinks == nil {
		zb0001Len--
		zb0001Mask |= 0x2000
	}
	if z.spanEvents == nil {
		zb0001Len--
		zb0001Mask |= 0x4000
	}
	// variable map header, size zb0001Len
	err = en.Append(0x80 | uint8(zb0001Len))
	if err != nil {
		return
	}

	// skip if no fields are to be emitted
	if zb0001Len != 0 {
		// write "name"
		err = en.Append(0xa4, 0x6e, 0x61, 0x6d, 0x65)
		if err != nil {
			return
		}
		err = en.WriteString(z.name)
		if err != nil {
			err = msgp.WrapError(err, "name")
			return
		}
		// write "service"
		err = en.Append(0xa7, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65)
		if err != nil {
			return
		}
		err = en.WriteString(z.service)
		if err != nil {
			err = msgp.WrapError(err, "service")
			return
		}
		// write "resource"
		err = en.Append(0xa8, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65)
		if err != nil {
			return
		}
		err = en.WriteString(z.resource)
		if err != nil {
			err = msgp.WrapError(err, "resource")
			return
		}
		// write "type"
		err = en.Append(0xa4, 0x74, 0x79, 0x70, 0x65)
		if err != nil {
			return
		}
		err = en.WriteString(z.spanType)
		if err != nil {
			err = msgp.WrapError(err, "spanType")
			return
		}
		// write "start"
		err = en.Append(0xa5, 0x73, 0x74, 0x61, 0x72, 0x74)
		if err != nil {
			return
		}
		err = en.WriteInt64(z.start)
		if err != nil {
			err = msgp.WrapError(err, "start")
			return
		}
		// write "duration"
		err = en.Append(0xa8, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e)
		if err != nil {
			return
		}
		err = en.WriteInt64(z.duration)
		if err != nil {
			err = msgp.WrapError(err, "duration")
			return
		}
		if (zb0001Mask & 0x40) == 0 { // if not omitted
			// write "meta"
			err = en.Append(0xa4, 0x6d, 0x65, 0x74, 0x61)
			if err != nil {
				return
			}
			err = en.WriteMapHeader(uint32(len(z.meta)))
			if err != nil {
				err = msgp.WrapError(err, "meta")
				return
			}
			for za0001, za0002 := range z.meta {
				err = en.WriteString(za0001)
				if err != nil {
					err = msgp.WrapError(err, "meta")
					return
				}
				err = en.WriteString(za0002)
				if err != nil {
					err = msgp.WrapError(err, "meta", za0001)
					return
				}
			}
		}
		// write "meta_struct"
		err = en.Append(0xab, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74)
		if err != nil {
			return
		}
		err = z.metaStruct.EncodeMsg(en)
		if err != nil {
			err = msgp.WrapError(err, "metaStruct")
			return
		}
		if (zb0001Mask & 0x100) == 0 { // if not omitted
			// write "metrics"
			err = en.Append(0xa7, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73)
			if err != nil {
				return
			}
			err = en.WriteMapHeader(uint32(len(z.metrics)))
			if err != nil {
				err = msgp.WrapError(err, "metrics")
				return
			}
			for za0003, za0004 := range z.metrics {
				err = en.WriteString(za0003)
				if err != nil {
					err = msgp.WrapError(err, "metrics")
					return
				}
				err = en.WriteFloat64(za0004)
				if err != nil {
					err = msgp.WrapError(err, "metrics", za0003)
					return
				}
			}
		}
		// write "span_id"
		err = en.Append(0xa7, 0x73, 0x70, 0x61, 0x6e, 0x5f, 0x69, 0x64)
		if err != nil {
			return
		}
		err = en.WriteUint64(z.spanID)
		if err != nil {
			err = msgp.WrapError(err, "spanID")
			return
		}
		// write "trace_id"
		err = en.Append(0xa8, 0x74, 0x72, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64)
		if err != nil {
			return
		}
		err = en.WriteUint64(z.traceID)
		if err != nil {
			err = msgp.WrapError(err, "traceID")
			return
		}
		// write "parent_id"
		err = en.Append(0xa9, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64)
		if err != nil {
			return
		}
		err = en.WriteUint64(z.parentID)
		if err != nil {
			err = msgp.WrapError(err, "parentID")
			return
		}
		// write "error"
		err = en.Append(0xa5, 0x65, 0x72, 0x72, 0x6f, 0x72)
		if err != nil {
			return
		}
		err = en.WriteInt32(z.error)
		if err != nil {
			err = msgp.WrapError(err, "error")
			return
		}
		if (zb0001Mask & 0x2000) == 0 { // if not omitted
			// write "span_links"
			err = en.Append(0xaa, 0x73, 0x70, 0x61, 0x6e, 0x5f, 0x6c, 0x69, 0x6e, 0x6b, 0x73)
			if err != nil {
				return
			}
			err = en.WriteArrayHeader(uint32(len(z.spanLinks)))
			if err != nil {
				err = msgp.WrapError(err, "spanLinks")
				return
			}
			for za0005 := range z.spanLinks {
				err = z.spanLinks[za0005].EncodeMsg(en)
				if err != nil {
					err = msgp.WrapError(err, "spanLinks", za0005)
					return
				}
			}
		}
		if (zb0001Mask & 0x4000) == 0 { // if not omitted
			// write "span_events"
			err = en.Append(0xab, 0x73, 0x70, 0x61, 0x6e, 0x5f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73)
			if err != nil {
				return
			}
			err = en.WriteArrayHeader(uint32(len(z.spanEvents)))
			if err != nil {
				err = msgp.WrapError(err, "spanEvents")
				return
			}
			for za0006 := range z.spanEvents {
				err = z.spanEvents[za0006].EncodeMsg(en)
				if err != nil {
					err = msgp.WrapError(err, "spanEvents", za0006)
					return
				}
			}
		}
	}
	return
}

// Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
// +checklocksignore — Generated code: post-finish serialization or pre-share deserialization.
func (z *Span) Msgsize() (s int) {
	s = 1 + 5 + msgp.StringPrefixSize + len(z.name) + 8 + msgp.StringPrefixSize + len(z.service) + 9 + msgp.StringPrefixSize + len(z.resource) + 5 + msgp.StringPrefixSize + len(z.spanType) + 6 + msgp.Int64Size + 9 + msgp.Int64Size + 5 + msgp.MapHeaderSize
	if z.meta != nil {
		for za0001, za0002 := range z.meta {
			_ = za0002
			s += msgp.StringPrefixSize + len(za0001) + msgp.StringPrefixSize + len(za0002)
		}
	}
	s += 12 + z.metaStruct.Msgsize() + 8 + msgp.MapHeaderSize
	if z.metrics != nil {
		for za0003, za0004 := range z.metrics {
			_ = za0004
			s += msgp.StringPrefixSize + len(za0003) + msgp.Float64Size
		}
	}
	s += 8 + msgp.Uint64Size + 9 + msgp.Uint64Size + 10 + msgp.Uint64Size + 6 + msgp.Int32Size + 11 + msgp.ArrayHeaderSize
	for za0005 := range z.spanLinks {
		s += z.spanLinks[za0005].Msgsize()
	}
	s += 12 + msgp.ArrayHeaderSize
	for za0006 := range z.spanEvents {
		s += z.spanEvents[za0006].Msgsize()
	}
	return
}

// DecodeMsg implements msgp.Decodable
func (z *errorConfig) DecodeMsg(dc *msgp.Reader) (err error) {
	var field []byte
	_ = field
	var zb0001 uint32
	zb0001, err = dc.ReadMapHeader()
	if err != nil {
		err = msgp.WrapError(err)
		return
	}
	for zb0001 > 0 {
		zb0001--
		field, err = dc.ReadMapKeyPtr()
		if err != nil {
			err = msgp.WrapError(err)
			return
		}
		switch msgp.UnsafeString(field) {
		case "noDebugStack":
			z.noDebugStack, err = dc.ReadBool()
			if err != nil {
				err = msgp.WrapError(err, "noDebugStack")
				return
			}
		case "stackFrames":
			z.stackFrames, err = dc.ReadUint()
			if err != nil {
				err = msgp.WrapError(err, "stackFrames")
				return
			}
		case "stackSkip":
			z.stackSkip, err = dc.ReadUint()
			if err != nil {
				err = msgp.WrapError(err, "stackSkip")
				return
			}
		default:
			err = dc.Skip()
			if err != nil {
				err = msgp.WrapError(err)
				return
			}
		}
	}
	return
}

// EncodeMsg implements msgp.Encodable
func (z errorConfig) EncodeMsg(en *msgp.Writer) (err error) {
	// map header, size 3
	// write "noDebugStack"
	err = en.Append(0x83, 0xac, 0x6e, 0x6f, 0x44, 0x65, 0x62, 0x75, 0x67, 0x53, 0x74, 0x61, 0x63, 0x6b)
	if err != nil {
		return
	}
	err = en.WriteBool(z.noDebugStack)
	if err != nil {
		err = msgp.WrapError(err, "noDebugStack")
		return
	}
	// write "stackFrames"
	err = en.Append(0xab, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x73)
	if err != nil {
		return
	}
	err = en.WriteUint(z.stackFrames)
	if err != nil {
		err = msgp.WrapError(err, "stackFrames")
		return
	}
	// write "stackSkip"
	err = en.Append(0xa9, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x53, 0x6b, 0x69, 0x70)
	if err != nil {
		return
	}
	err = en.WriteUint(z.stackSkip)
	if err != nil {
		err = msgp.WrapError(err, "stackSkip")
		return
	}
	return
}

// Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (z errorConfig) Msgsize() (s int) {
	s = 1 + 13 + msgp.BoolSize + 12 + msgp.UintSize + 10 + msgp.UintSize
	return
}

// DecodeMsg implements msgp.Decodable
func (z *spanList) DecodeMsg(dc *msgp.Reader) (err error) {
	var zb0002 uint32
	zb0002, err = dc.ReadArrayHeader()
	if err != nil {
		err = msgp.WrapError(err)
		return
	}
	if cap((*z)) >= int(zb0002) {
		(*z) = (*z)[:zb0002]
	} else {
		(*z) = make(spanList, zb0002)
	}
	for zb0001 := range *z {
		if dc.IsNil() {
			err = dc.ReadNil()
			if err != nil {
				err = msgp.WrapError(err, zb0001)
				return
			}
			(*z)[zb0001] = nil
		} else {
			if (*z)[zb0001] == nil {
				(*z)[zb0001] = new(Span)
			}
			err = (*z)[zb0001].DecodeMsg(dc)
			if err != nil {
				err = msgp.WrapError(err, zb0001)
				return
			}
		}
	}
	return
}

// EncodeMsg implements msgp.Encodable
func (z spanList) EncodeMsg(en *msgp.Writer) (err error) {
	err = en.WriteArrayHeader(uint32(len(z)))
	if err != nil {
		err = msgp.WrapError(err)
		return
	}
	for zb0003 := range z {
		if z[zb0003] == nil {
			err = en.WriteNil()
			if err != nil {
				return
			}
		} else {
			err = z[zb0003].EncodeMsg(en)
			if err != nil {
				err = msgp.WrapError(err, zb0003)
				return
			}
		}
	}
	return
}

// Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (z spanList) Msgsize() (s int) {
	s = msgp.ArrayHeaderSize
	for zb0003 := range z {
		if z[zb0003] == nil {
			s += msgp.NilSize
		} else {
			s += z[zb0003].Msgsize()
		}
	}
	return
}

// DecodeMsg implements msgp.Decodable
func (z *spanLists) DecodeMsg(dc *msgp.Reader) (err error) {
	var zb0003 uint32
	zb0003, err = dc.ReadArrayHeader()
	if err != nil {
		err = msgp.WrapError(err)
		return
	}
	if cap((*z)) >= int(zb0003) {
		(*z) = (*z)[:zb0003]
	} else {
		(*z) = make(spanLists, zb0003)
	}
	for zb0001 := range *z {
		var zb0004 uint32
		zb0004, err = dc.ReadArrayHeader()
		if err != nil {
			err = msgp.WrapError(err, zb0001)
			return
		}
		if cap((*z)[zb0001]) >= int(zb0004) {
			(*z)[zb0001] = ((*z)[zb0001])[:zb0004]
		} else {
			(*z)[zb0001] = make(spanList, zb0004)
		}
		for zb0002 := range (*z)[zb0001] {
			if dc.IsNil() {
				err = dc.ReadNil()
				if err != nil {
					err = msgp.WrapError(err, zb0001, zb0002)
					return
				}
				(*z)[zb0001][zb0002] = nil
			} else {
				if (*z)[zb0001][zb0002] == nil {
					(*z)[zb0001][zb0002] = new(Span)
				}
				err = (*z)[zb0001][zb0002].DecodeMsg(dc)
				if err != nil {
					err = msgp.WrapError(err, zb0001, zb0002)
					return
				}
			}
		}
	}
	return
}

// EncodeMsg implements msgp.Encodable
func (z spanLists) EncodeMsg(en *msgp.Writer) (err error) {
	err = en.WriteArrayHeader(uint32(len(z)))
	if err != nil {
		err = msgp.WrapError(err)
		return
	}
	for zb0005 := range z {
		err = en.WriteArrayHeader(uint32(len(z[zb0005])))
		if err != nil {
			err = msgp.WrapError(err, zb0005)
			return
		}
		for zb0006 := range z[zb0005] {
			if z[zb0005][zb0006] == nil {
				err = en.WriteNil()
				if err != nil {
					return
				}
			} else {
				err = z[zb0005][zb0006].EncodeMsg(en)
				if err != nil {
					err = msgp.WrapError(err, zb0005, zb0006)
					return
				}
			}
		}
	}
	return
}

// Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (z spanLists) Msgsize() (s int) {
	s = msgp.ArrayHeaderSize
	for zb0005 := range z {
		s += msgp.ArrayHeaderSize
		for zb0006 := range z[zb0005] {
			if z[zb0005][zb0006] == nil {
				s += msgp.NilSize
			} else {
				s += z[zb0005][zb0006].Msgsize()
			}
		}
	}
	return
}
