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

package stacktrace

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

// DecodeMsg implements msgp.Decodable
func (z *RawStackTrace) 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) {
		default:
			err = dc.Skip()
			if err != nil {
				err = msgp.WrapError(err)
				return
			}
		}
	}
	return
}

// EncodeMsg implements msgp.Encodable
func (z RawStackTrace) EncodeMsg(en *msgp.Writer) (err error) {
	// map header, size 0
	_ = z
	err = en.Append(0x80)
	if err != nil {
		return
	}
	return
}

// MarshalMsg implements msgp.Marshaler
func (z RawStackTrace) MarshalMsg(b []byte) (o []byte, err error) {
	o = msgp.Require(b, z.Msgsize())
	// map header, size 0
	_ = z
	o = append(o, 0x80)
	return
}

// UnmarshalMsg implements msgp.Unmarshaler
func (z *RawStackTrace) UnmarshalMsg(bts []byte) (o []byte, err error) {
	var field []byte
	_ = field
	var zb0001 uint32
	zb0001, bts, err = msgp.ReadMapHeaderBytes(bts)
	if err != nil {
		err = msgp.WrapError(err)
		return
	}
	for zb0001 > 0 {
		zb0001--
		field, bts, err = msgp.ReadMapKeyZC(bts)
		if err != nil {
			err = msgp.WrapError(err)
			return
		}
		switch msgp.UnsafeString(field) {
		default:
			bts, err = msgp.Skip(bts)
			if err != nil {
				err = msgp.WrapError(err)
				return
			}
		}
	}
	o = bts
	return
}

// Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (z RawStackTrace) Msgsize() (s int) {
	s = 1
	return
}

// DecodeMsg implements msgp.Decodable
func (z *StackFrame) 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 "text":
			z.Text, err = dc.ReadString()
			if err != nil {
				err = msgp.WrapError(err, "Text")
				return
			}
		case "file":
			z.File, err = dc.ReadString()
			if err != nil {
				err = msgp.WrapError(err, "File")
				return
			}
		case "namespace":
			z.Namespace, err = dc.ReadString()
			if err != nil {
				err = msgp.WrapError(err, "Namespace")
				return
			}
		case "class_name":
			z.ClassName, err = dc.ReadString()
			if err != nil {
				err = msgp.WrapError(err, "ClassName")
				return
			}
		case "function":
			z.Function, err = dc.ReadString()
			if err != nil {
				err = msgp.WrapError(err, "Function")
				return
			}
		case "id":
			z.Index, err = dc.ReadUint32()
			if err != nil {
				err = msgp.WrapError(err, "Index")
				return
			}
		case "line":
			z.Line, err = dc.ReadUint32()
			if err != nil {
				err = msgp.WrapError(err, "Line")
				return
			}
		case "column":
			z.Column, err = dc.ReadUint32()
			if err != nil {
				err = msgp.WrapError(err, "Column")
				return
			}
		default:
			err = dc.Skip()
			if err != nil {
				err = msgp.WrapError(err)
				return
			}
		}
	}
	return
}

// EncodeMsg implements msgp.Encodable
func (z *StackFrame) EncodeMsg(en *msgp.Writer) (err error) {
	// check for omitted fields
	zb0001Len := uint32(8)
	var zb0001Mask uint8 /* 8 bits */
	_ = zb0001Mask
	if z.Text == "" {
		zb0001Len--
		zb0001Mask |= 0x1
	}
	if z.File == "" {
		zb0001Len--
		zb0001Mask |= 0x2
	}
	if z.Namespace == "" {
		zb0001Len--
		zb0001Mask |= 0x4
	}
	if z.ClassName == "" {
		zb0001Len--
		zb0001Mask |= 0x8
	}
	if z.Function == "" {
		zb0001Len--
		zb0001Mask |= 0x10
	}
	if z.Line == 0 {
		zb0001Len--
		zb0001Mask |= 0x40
	}
	if z.Column == 0 {
		zb0001Len--
		zb0001Mask |= 0x80
	}
	// 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 {
		if (zb0001Mask & 0x1) == 0 { // if not omitted
			// write "text"
			err = en.Append(0xa4, 0x74, 0x65, 0x78, 0x74)
			if err != nil {
				return
			}
			err = en.WriteString(z.Text)
			if err != nil {
				err = msgp.WrapError(err, "Text")
				return
			}
		}
		if (zb0001Mask & 0x2) == 0 { // if not omitted
			// write "file"
			err = en.Append(0xa4, 0x66, 0x69, 0x6c, 0x65)
			if err != nil {
				return
			}
			err = en.WriteString(z.File)
			if err != nil {
				err = msgp.WrapError(err, "File")
				return
			}
		}
		if (zb0001Mask & 0x4) == 0 { // if not omitted
			// write "namespace"
			err = en.Append(0xa9, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65)
			if err != nil {
				return
			}
			err = en.WriteString(z.Namespace)
			if err != nil {
				err = msgp.WrapError(err, "Namespace")
				return
			}
		}
		if (zb0001Mask & 0x8) == 0 { // if not omitted
			// write "class_name"
			err = en.Append(0xaa, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x6e, 0x61, 0x6d, 0x65)
			if err != nil {
				return
			}
			err = en.WriteString(z.ClassName)
			if err != nil {
				err = msgp.WrapError(err, "ClassName")
				return
			}
		}
		if (zb0001Mask & 0x10) == 0 { // if not omitted
			// write "function"
			err = en.Append(0xa8, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e)
			if err != nil {
				return
			}
			err = en.WriteString(z.Function)
			if err != nil {
				err = msgp.WrapError(err, "Function")
				return
			}
		}
		// write "id"
		err = en.Append(0xa2, 0x69, 0x64)
		if err != nil {
			return
		}
		err = en.WriteUint32(z.Index)
		if err != nil {
			err = msgp.WrapError(err, "Index")
			return
		}
		if (zb0001Mask & 0x40) == 0 { // if not omitted
			// write "line"
			err = en.Append(0xa4, 0x6c, 0x69, 0x6e, 0x65)
			if err != nil {
				return
			}
			err = en.WriteUint32(z.Line)
			if err != nil {
				err = msgp.WrapError(err, "Line")
				return
			}
		}
		if (zb0001Mask & 0x80) == 0 { // if not omitted
			// write "column"
			err = en.Append(0xa6, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e)
			if err != nil {
				return
			}
			err = en.WriteUint32(z.Column)
			if err != nil {
				err = msgp.WrapError(err, "Column")
				return
			}
		}
	}
	return
}

// MarshalMsg implements msgp.Marshaler
func (z *StackFrame) MarshalMsg(b []byte) (o []byte, err error) {
	o = msgp.Require(b, z.Msgsize())
	// check for omitted fields
	zb0001Len := uint32(8)
	var zb0001Mask uint8 /* 8 bits */
	_ = zb0001Mask
	if z.Text == "" {
		zb0001Len--
		zb0001Mask |= 0x1
	}
	if z.File == "" {
		zb0001Len--
		zb0001Mask |= 0x2
	}
	if z.Namespace == "" {
		zb0001Len--
		zb0001Mask |= 0x4
	}
	if z.ClassName == "" {
		zb0001Len--
		zb0001Mask |= 0x8
	}
	if z.Function == "" {
		zb0001Len--
		zb0001Mask |= 0x10
	}
	if z.Line == 0 {
		zb0001Len--
		zb0001Mask |= 0x40
	}
	if z.Column == 0 {
		zb0001Len--
		zb0001Mask |= 0x80
	}
	// variable map header, size zb0001Len
	o = append(o, 0x80|uint8(zb0001Len))

	// skip if no fields are to be emitted
	if zb0001Len != 0 {
		if (zb0001Mask & 0x1) == 0 { // if not omitted
			// string "text"
			o = append(o, 0xa4, 0x74, 0x65, 0x78, 0x74)
			o = msgp.AppendString(o, z.Text)
		}
		if (zb0001Mask & 0x2) == 0 { // if not omitted
			// string "file"
			o = append(o, 0xa4, 0x66, 0x69, 0x6c, 0x65)
			o = msgp.AppendString(o, z.File)
		}
		if (zb0001Mask & 0x4) == 0 { // if not omitted
			// string "namespace"
			o = append(o, 0xa9, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65)
			o = msgp.AppendString(o, z.Namespace)
		}
		if (zb0001Mask & 0x8) == 0 { // if not omitted
			// string "class_name"
			o = append(o, 0xaa, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x6e, 0x61, 0x6d, 0x65)
			o = msgp.AppendString(o, z.ClassName)
		}
		if (zb0001Mask & 0x10) == 0 { // if not omitted
			// string "function"
			o = append(o, 0xa8, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e)
			o = msgp.AppendString(o, z.Function)
		}
		// string "id"
		o = append(o, 0xa2, 0x69, 0x64)
		o = msgp.AppendUint32(o, z.Index)
		if (zb0001Mask & 0x40) == 0 { // if not omitted
			// string "line"
			o = append(o, 0xa4, 0x6c, 0x69, 0x6e, 0x65)
			o = msgp.AppendUint32(o, z.Line)
		}
		if (zb0001Mask & 0x80) == 0 { // if not omitted
			// string "column"
			o = append(o, 0xa6, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e)
			o = msgp.AppendUint32(o, z.Column)
		}
	}
	return
}

// UnmarshalMsg implements msgp.Unmarshaler
func (z *StackFrame) UnmarshalMsg(bts []byte) (o []byte, err error) {
	var field []byte
	_ = field
	var zb0001 uint32
	zb0001, bts, err = msgp.ReadMapHeaderBytes(bts)
	if err != nil {
		err = msgp.WrapError(err)
		return
	}
	for zb0001 > 0 {
		zb0001--
		field, bts, err = msgp.ReadMapKeyZC(bts)
		if err != nil {
			err = msgp.WrapError(err)
			return
		}
		switch msgp.UnsafeString(field) {
		case "text":
			z.Text, bts, err = msgp.ReadStringBytes(bts)
			if err != nil {
				err = msgp.WrapError(err, "Text")
				return
			}
		case "file":
			z.File, bts, err = msgp.ReadStringBytes(bts)
			if err != nil {
				err = msgp.WrapError(err, "File")
				return
			}
		case "namespace":
			z.Namespace, bts, err = msgp.ReadStringBytes(bts)
			if err != nil {
				err = msgp.WrapError(err, "Namespace")
				return
			}
		case "class_name":
			z.ClassName, bts, err = msgp.ReadStringBytes(bts)
			if err != nil {
				err = msgp.WrapError(err, "ClassName")
				return
			}
		case "function":
			z.Function, bts, err = msgp.ReadStringBytes(bts)
			if err != nil {
				err = msgp.WrapError(err, "Function")
				return
			}
		case "id":
			z.Index, bts, err = msgp.ReadUint32Bytes(bts)
			if err != nil {
				err = msgp.WrapError(err, "Index")
				return
			}
		case "line":
			z.Line, bts, err = msgp.ReadUint32Bytes(bts)
			if err != nil {
				err = msgp.WrapError(err, "Line")
				return
			}
		case "column":
			z.Column, bts, err = msgp.ReadUint32Bytes(bts)
			if err != nil {
				err = msgp.WrapError(err, "Column")
				return
			}
		default:
			bts, err = msgp.Skip(bts)
			if err != nil {
				err = msgp.WrapError(err)
				return
			}
		}
	}
	o = bts
	return
}

// Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (z *StackFrame) Msgsize() (s int) {
	s = 1 + 5 + msgp.StringPrefixSize + len(z.Text) + 5 + msgp.StringPrefixSize + len(z.File) + 10 + msgp.StringPrefixSize + len(z.Namespace) + 11 + msgp.StringPrefixSize + len(z.ClassName) + 9 + msgp.StringPrefixSize + len(z.Function) + 3 + msgp.Uint32Size + 5 + msgp.Uint32Size + 7 + msgp.Uint32Size
	return
}

// DecodeMsg implements msgp.Decodable
func (z *StackTrace) 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(StackTrace, zb0002)
	}
	for zb0001 := range *z {
		err = (*z)[zb0001].DecodeMsg(dc)
		if err != nil {
			err = msgp.WrapError(err, zb0001)
			return
		}
	}
	return
}

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

// MarshalMsg implements msgp.Marshaler
func (z StackTrace) MarshalMsg(b []byte) (o []byte, err error) {
	o = msgp.Require(b, z.Msgsize())
	o = msgp.AppendArrayHeader(o, uint32(len(z)))
	for zb0003 := range z {
		o, err = z[zb0003].MarshalMsg(o)
		if err != nil {
			err = msgp.WrapError(err, zb0003)
			return
		}
	}
	return
}

// UnmarshalMsg implements msgp.Unmarshaler
func (z *StackTrace) UnmarshalMsg(bts []byte) (o []byte, err error) {
	var zb0002 uint32
	zb0002, bts, err = msgp.ReadArrayHeaderBytes(bts)
	if err != nil {
		err = msgp.WrapError(err)
		return
	}
	if cap((*z)) >= int(zb0002) {
		(*z) = (*z)[:zb0002]
	} else {
		(*z) = make(StackTrace, zb0002)
	}
	for zb0001 := range *z {
		bts, err = (*z)[zb0001].UnmarshalMsg(bts)
		if err != nil {
			err = msgp.WrapError(err, zb0001)
			return
		}
	}
	o = bts
	return
}

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