// Code generated by thriftgo (0.3.15) (fastgo). DO NOT EDIT.
package example

import (
	"encoding/binary"
	"fmt"
	"unsafe"

	"github.com/cloudwego/dynamicgo/testdata/kitex_gen/base"
	"github.com/cloudwego/dynamicgo/testdata/kitex_gen/deep"
	"github.com/cloudwego/gopkg/protocol/thrift"
)

var (
	_ = base.KitexUnusedProtection
	_ = deep.KitexUnusedProtection
)

func (p *ExampleReq) BLength() int {
	if p == nil {
		return 1
	}
	off := 0

	// p.Msg ID:1 thrift.STRING
	if p.Msg != nil {
		off += 3
		off += 4 + len(*p.Msg)
	}

	// p.InnerBase ID:3 thrift.I32
	off += 3
	off += 4

	// p.Base ID:255 thrift.STRUCT
	off += 3
	off += p.Base.BLength()

	// p.Subfix ID:32767 thrift.DOUBLE
	off += 3
	off += 8
	return off + 1
}

func (p *ExampleReq) FastWrite(b []byte) int { return p.FastWriteNocopy(b, nil) }

func (p *ExampleReq) FastWriteNocopy(b []byte, w thrift.NocopyWriter) int {
	if p == nil {
		b[0] = 0
		return 1
	}
	off := 0

	// p.Msg ID:1 thrift.STRING
	if p.Msg != nil {
		b[off] = 11
		binary.BigEndian.PutUint16(b[off+1:], 1)
		off += 3
		off += thrift.Binary.WriteStringNocopy(b[off:], w, *p.Msg)
	}

	// p.InnerBase ID:3 thrift.I32
	b[off] = 8
	binary.BigEndian.PutUint16(b[off+1:], 3)
	off += 3
	binary.BigEndian.PutUint32(b[off:], uint32(p.InnerBase))
	off += 4

	// p.Base ID:255 thrift.STRUCT
	b[off] = 12
	binary.BigEndian.PutUint16(b[off+1:], 255)
	off += 3
	off += p.Base.FastWriteNocopy(b[off:], w)

	// p.Subfix ID:32767 thrift.DOUBLE
	b[off] = 4
	binary.BigEndian.PutUint16(b[off+1:], 32767)
	off += 3
	binary.BigEndian.PutUint64(b[off:], *(*uint64)(unsafe.Pointer(&p.Subfix)))
	off += 8

	b[off] = 0
	return off + 1
}

func (p *ExampleReq) FastRead(b []byte) (off int, err error) {
	var ftyp thrift.TType
	var fid int16
	var l int
	var isset uint8
	x := thrift.BinaryProtocol{}
	for {
		ftyp, fid, l, err = x.ReadFieldBegin(b[off:])
		off += l
		if err != nil {
			goto ReadFieldBeginError
		}
		if ftyp == thrift.STOP {
			break
		}
		switch uint32(fid)<<8 | uint32(ftyp) {
		case 0x10b: // p.Msg ID:1 thrift.STRING
			if p.Msg == nil {
				p.Msg = new(string)
			}
			*p.Msg, l, err = x.ReadString(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		case 0x308: // p.InnerBase ID:3 thrift.I32
			p.InnerBase, l, err = x.ReadI32(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		case 0xff0c: // p.Base ID:255 thrift.STRUCT
			p.Base = base.NewBase()
			l, err = p.Base.FastRead(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
			isset |= 0x1
		case 0x7fff04: // p.Subfix ID:32767 thrift.DOUBLE
			p.Subfix, l, err = x.ReadDouble(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		default:
			l, err = x.Skip(b[off:], ftyp)
			off += l
			if err != nil {
				goto SkipFieldError
			}
		}
	}
	if isset&0x1 == 0 {
		fid = 255 // Base
		goto RequiredFieldNotSetError
	}
	return
ReadFieldBeginError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field begin error: ", p), err)
ReadFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fid, fieldIDToName_ExampleReq[fid]), err)
SkipFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T skip field %d type %d error: ", p, fid, ftyp), err)
RequiredFieldNotSetError:
	return off, thrift.NewProtocolException(thrift.INVALID_DATA, fmt.Sprintf("required field %s is not set", fieldIDToName_ExampleReq[fid]))
}

func (p *ExampleToSnakeCase) BLength() int {
	if p == nil {
		return 1
	}
	off := 0

	// p.Msg ID:1 thrift.STRING
	if p.Msg != nil {
		off += 3
		off += 4 + len(*p.Msg)
	}

	// p.ReqList ID:2 thrift.LIST
	off += 3
	off += 5
	for _, v := range p.ReqList {
		off += 4 + len(v)
	}

	// p.InnerBase ID:3 thrift.I32
	off += 3
	off += 4

	// p.Base ID:255 thrift.STRUCT
	off += 3
	off += p.Base.BLength()
	return off + 1
}

func (p *ExampleToSnakeCase) FastWrite(b []byte) int { return p.FastWriteNocopy(b, nil) }

func (p *ExampleToSnakeCase) FastWriteNocopy(b []byte, w thrift.NocopyWriter) int {
	if p == nil {
		b[0] = 0
		return 1
	}
	off := 0

	// p.Msg ID:1 thrift.STRING
	if p.Msg != nil {
		b[off] = 11
		binary.BigEndian.PutUint16(b[off+1:], 1)
		off += 3
		off += thrift.Binary.WriteStringNocopy(b[off:], w, *p.Msg)
	}

	// p.ReqList ID:2 thrift.LIST
	b[off] = 15
	binary.BigEndian.PutUint16(b[off+1:], 2)
	off += 3
	b[off] = 11
	binary.BigEndian.PutUint32(b[off+1:], uint32(len(p.ReqList)))
	off += 5
	for _, v := range p.ReqList {
		off += thrift.Binary.WriteStringNocopy(b[off:], w, v)
	}

	// p.InnerBase ID:3 thrift.I32
	b[off] = 8
	binary.BigEndian.PutUint16(b[off+1:], 3)
	off += 3
	binary.BigEndian.PutUint32(b[off:], uint32(p.InnerBase))
	off += 4

	// p.Base ID:255 thrift.STRUCT
	b[off] = 12
	binary.BigEndian.PutUint16(b[off+1:], 255)
	off += 3
	off += p.Base.FastWriteNocopy(b[off:], w)

	b[off] = 0
	return off + 1
}

func (p *ExampleToSnakeCase) FastRead(b []byte) (off int, err error) {
	var ftyp thrift.TType
	var fid int16
	var l int
	var isset uint8
	x := thrift.BinaryProtocol{}
	for {
		ftyp, fid, l, err = x.ReadFieldBegin(b[off:])
		off += l
		if err != nil {
			goto ReadFieldBeginError
		}
		if ftyp == thrift.STOP {
			break
		}
		switch uint32(fid)<<8 | uint32(ftyp) {
		case 0x10b: // p.Msg ID:1 thrift.STRING
			if p.Msg == nil {
				p.Msg = new(string)
			}
			*p.Msg, l, err = x.ReadString(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		case 0x20f: // p.ReqList ID:2 thrift.LIST
			var sz int
			_, sz, l, err = x.ReadListBegin(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
			p.ReqList = make([]string, sz)
			for i := 0; i < sz; i++ {
				p.ReqList[i], l, err = x.ReadString(b[off:])
				off += l
				if err != nil {
					goto ReadFieldError
				}
			}
		case 0x308: // p.InnerBase ID:3 thrift.I32
			p.InnerBase, l, err = x.ReadI32(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		case 0xff0c: // p.Base ID:255 thrift.STRUCT
			p.Base = base.NewBase()
			l, err = p.Base.FastRead(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
			isset |= 0x1
		default:
			l, err = x.Skip(b[off:], ftyp)
			off += l
			if err != nil {
				goto SkipFieldError
			}
		}
	}
	if isset&0x1 == 0 {
		fid = 255 // Base
		goto RequiredFieldNotSetError
	}
	return
ReadFieldBeginError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field begin error: ", p), err)
ReadFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fid, fieldIDToName_ExampleToSnakeCase[fid]), err)
SkipFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T skip field %d type %d error: ", p, fid, ftyp), err)
RequiredFieldNotSetError:
	return off, thrift.NewProtocolException(thrift.INVALID_DATA, fmt.Sprintf("required field %s is not set", fieldIDToName_ExampleToSnakeCase[fid]))
}

func (p *ExampleResp) BLength() int {
	if p == nil {
		return 1
	}
	off := 0

	// p.Msg ID:1 thrift.STRING
	if p.Msg != nil {
		off += 3
		off += 4 + len(*p.Msg)
	}

	// p.RequiredField ID:2 thrift.STRING
	off += 3
	off += 4 + len(p.RequiredField)

	// p.BaseResp ID:32767 thrift.STRUCT
	off += 3
	off += p.BaseResp.BLength()
	return off + 1
}

func (p *ExampleResp) FastWrite(b []byte) int { return p.FastWriteNocopy(b, nil) }

func (p *ExampleResp) FastWriteNocopy(b []byte, w thrift.NocopyWriter) int {
	if p == nil {
		b[0] = 0
		return 1
	}
	off := 0

	// p.Msg ID:1 thrift.STRING
	if p.Msg != nil {
		b[off] = 11
		binary.BigEndian.PutUint16(b[off+1:], 1)
		off += 3
		off += thrift.Binary.WriteStringNocopy(b[off:], w, *p.Msg)
	}

	// p.RequiredField ID:2 thrift.STRING
	b[off] = 11
	binary.BigEndian.PutUint16(b[off+1:], 2)
	off += 3
	off += thrift.Binary.WriteStringNocopy(b[off:], w, p.RequiredField)

	// p.BaseResp ID:32767 thrift.STRUCT
	b[off] = 12
	binary.BigEndian.PutUint16(b[off+1:], 32767)
	off += 3
	off += p.BaseResp.FastWriteNocopy(b[off:], w)

	b[off] = 0
	return off + 1
}

func (p *ExampleResp) FastRead(b []byte) (off int, err error) {
	var ftyp thrift.TType
	var fid int16
	var l int
	var isset uint8
	x := thrift.BinaryProtocol{}
	for {
		ftyp, fid, l, err = x.ReadFieldBegin(b[off:])
		off += l
		if err != nil {
			goto ReadFieldBeginError
		}
		if ftyp == thrift.STOP {
			break
		}
		switch uint32(fid)<<8 | uint32(ftyp) {
		case 0x10b: // p.Msg ID:1 thrift.STRING
			if p.Msg == nil {
				p.Msg = new(string)
			}
			*p.Msg, l, err = x.ReadString(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		case 0x20b: // p.RequiredField ID:2 thrift.STRING
			p.RequiredField, l, err = x.ReadString(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
			isset |= 0x1
		case 0x7fff0c: // p.BaseResp ID:32767 thrift.STRUCT
			p.BaseResp = base.NewBaseResp()
			l, err = p.BaseResp.FastRead(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		default:
			l, err = x.Skip(b[off:], ftyp)
			off += l
			if err != nil {
				goto SkipFieldError
			}
		}
	}
	if isset&0x1 == 0 {
		fid = 2 // RequiredField
		goto RequiredFieldNotSetError
	}
	return
ReadFieldBeginError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field begin error: ", p), err)
ReadFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fid, fieldIDToName_ExampleResp[fid]), err)
SkipFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T skip field %d type %d error: ", p, fid, ftyp), err)
RequiredFieldNotSetError:
	return off, thrift.NewProtocolException(thrift.INVALID_DATA, fmt.Sprintf("required field %s is not set", fieldIDToName_ExampleResp[fid]))
}

func (p *A) BLength() int {
	if p == nil {
		return 1
	}
	off := 0

	// p.Self ID:1 thrift.STRING
	off += 3
	off += 4 + len(p.Self)

	// p.Foo ID:2 thrift.I32
	off += 3
	off += 4
	return off + 1
}

func (p *A) FastWrite(b []byte) int { return p.FastWriteNocopy(b, nil) }

func (p *A) FastWriteNocopy(b []byte, w thrift.NocopyWriter) int {
	if p == nil {
		b[0] = 0
		return 1
	}
	off := 0

	// p.Self ID:1 thrift.STRING
	b[off] = 11
	binary.BigEndian.PutUint16(b[off+1:], 1)
	off += 3
	off += thrift.Binary.WriteStringNocopy(b[off:], w, p.Self)

	// p.Foo ID:2 thrift.I32
	b[off] = 8
	binary.BigEndian.PutUint16(b[off+1:], 2)
	off += 3
	binary.BigEndian.PutUint32(b[off:], uint32(p.Foo))
	off += 4

	b[off] = 0
	return off + 1
}

func (p *A) FastRead(b []byte) (off int, err error) {
	var ftyp thrift.TType
	var fid int16
	var l int
	var enum int32
	x := thrift.BinaryProtocol{}
	for {
		ftyp, fid, l, err = x.ReadFieldBegin(b[off:])
		off += l
		if err != nil {
			goto ReadFieldBeginError
		}
		if ftyp == thrift.STOP {
			break
		}
		switch uint32(fid)<<8 | uint32(ftyp) {
		case 0x10b: // p.Self ID:1 thrift.STRING
			p.Self, l, err = x.ReadString(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		case 0x208: // p.Foo ID:2 thrift.I32
			enum, l, err = x.ReadI32(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
			p.Foo = FOO(enum)
		default:
			l, err = x.Skip(b[off:], ftyp)
			off += l
			if err != nil {
				goto SkipFieldError
			}
		}
	}
	return
ReadFieldBeginError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field begin error: ", p), err)
ReadFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fid, fieldIDToName_A[fid]), err)
SkipFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T skip field %d type %d error: ", p, fid, ftyp), err)
}

func (p *ExampleDefaultValue) BLength() int {
	if p == nil {
		return 1
	}
	off := 0

	// p.String_ ID:1 thrift.STRING
	off += 3
	off += 4 + len(p.String_)

	// p.Int ID:2 thrift.I32
	off += 3
	off += 4

	// p.Double ID:3 thrift.DOUBLE
	off += 3
	off += 8

	// p.Bool ID:4 thrift.BOOL
	off += 3
	off += 1

	// p.List ID:5 thrift.LIST
	off += 3
	off += 5
	for _, v := range p.List {
		off += 4 + len(v)
	}

	// p.Map ID:6 thrift.MAP
	off += 3
	off += 6
	for k, v := range p.Map {
		off += 4 + len(k)
		off += 4 + len(v)
	}

	// p.Set ID:7 thrift.SET
	off += 3
	off += 5
	for _, v := range p.Set {
		off += 4 + len(v)
	}

	// p.ConstString ID:8 thrift.STRING
	off += 3
	off += 4 + len(p.ConstString)

	// p.Enum ID:9 thrift.I32
	off += 3
	off += 4
	return off + 1
}

func (p *ExampleDefaultValue) FastWrite(b []byte) int { return p.FastWriteNocopy(b, nil) }

func (p *ExampleDefaultValue) FastWriteNocopy(b []byte, w thrift.NocopyWriter) int {
	if p == nil {
		b[0] = 0
		return 1
	}
	off := 0

	// p.String_ ID:1 thrift.STRING
	b[off] = 11
	binary.BigEndian.PutUint16(b[off+1:], 1)
	off += 3
	off += thrift.Binary.WriteStringNocopy(b[off:], w, p.String_)

	// p.Int ID:2 thrift.I32
	b[off] = 8
	binary.BigEndian.PutUint16(b[off+1:], 2)
	off += 3
	binary.BigEndian.PutUint32(b[off:], uint32(p.Int))
	off += 4

	// p.Double ID:3 thrift.DOUBLE
	b[off] = 4
	binary.BigEndian.PutUint16(b[off+1:], 3)
	off += 3
	binary.BigEndian.PutUint64(b[off:], *(*uint64)(unsafe.Pointer(&p.Double)))
	off += 8

	// p.Bool ID:4 thrift.BOOL
	b[off] = 2
	binary.BigEndian.PutUint16(b[off+1:], 4)
	off += 3
	b[off] = *((*byte)(unsafe.Pointer(&p.Bool)))
	off++

	// p.List ID:5 thrift.LIST
	b[off] = 15
	binary.BigEndian.PutUint16(b[off+1:], 5)
	off += 3
	b[off] = 11
	binary.BigEndian.PutUint32(b[off+1:], uint32(len(p.List)))
	off += 5
	for _, v := range p.List {
		off += thrift.Binary.WriteStringNocopy(b[off:], w, v)
	}

	// p.Map ID:6 thrift.MAP
	b[off] = 13
	binary.BigEndian.PutUint16(b[off+1:], 6)
	off += 3
	b[off] = 11
	b[off+1] = 11
	binary.BigEndian.PutUint32(b[off+2:], uint32(len(p.Map)))
	off += 6
	for k, v := range p.Map {
		off += thrift.Binary.WriteStringNocopy(b[off:], w, k)
		off += thrift.Binary.WriteStringNocopy(b[off:], w, v)
	}

	// p.Set ID:7 thrift.SET
	b[off] = 14
	binary.BigEndian.PutUint16(b[off+1:], 7)
	off += 3
	b[off] = 11
	binary.BigEndian.PutUint32(b[off+1:], uint32(len(p.Set)))
	off += 5
	for _, v := range p.Set {
		off += thrift.Binary.WriteStringNocopy(b[off:], w, v)
	}

	// p.ConstString ID:8 thrift.STRING
	b[off] = 11
	binary.BigEndian.PutUint16(b[off+1:], 8)
	off += 3
	off += thrift.Binary.WriteStringNocopy(b[off:], w, p.ConstString)

	// p.Enum ID:9 thrift.I32
	b[off] = 8
	binary.BigEndian.PutUint16(b[off+1:], 9)
	off += 3
	binary.BigEndian.PutUint32(b[off:], uint32(p.Enum))
	off += 4

	b[off] = 0
	return off + 1
}

func (p *ExampleDefaultValue) FastRead(b []byte) (off int, err error) {
	var ftyp thrift.TType
	var fid int16
	var l int
	var enum int32
	x := thrift.BinaryProtocol{}
	for {
		ftyp, fid, l, err = x.ReadFieldBegin(b[off:])
		off += l
		if err != nil {
			goto ReadFieldBeginError
		}
		if ftyp == thrift.STOP {
			break
		}
		switch uint32(fid)<<8 | uint32(ftyp) {
		case 0x10b: // p.String_ ID:1 thrift.STRING
			p.String_, l, err = x.ReadString(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		case 0x208: // p.Int ID:2 thrift.I32
			p.Int, l, err = x.ReadI32(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		case 0x304: // p.Double ID:3 thrift.DOUBLE
			p.Double, l, err = x.ReadDouble(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		case 0x402: // p.Bool ID:4 thrift.BOOL
			p.Bool, l, err = x.ReadBool(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		case 0x50f: // p.List ID:5 thrift.LIST
			var sz int
			_, sz, l, err = x.ReadListBegin(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
			p.List = make([]string, sz)
			for i := 0; i < sz; i++ {
				p.List[i], l, err = x.ReadString(b[off:])
				off += l
				if err != nil {
					goto ReadFieldError
				}
			}
		case 0x60d: // p.Map ID:6 thrift.MAP
			var sz int
			_, _, sz, l, err = x.ReadMapBegin(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
			p.Map = make(map[string]string, sz)
			for i := 0; i < sz; i++ {
				var k string
				var v string
				k, l, err = x.ReadString(b[off:])
				off += l
				if err != nil {
					goto ReadFieldError
				}
				v, l, err = x.ReadString(b[off:])
				off += l
				if err != nil {
					goto ReadFieldError
				}
				p.Map[k] = v
			}
		case 0x70e: // p.Set ID:7 thrift.SET
			var sz int
			_, sz, l, err = x.ReadListBegin(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
			p.Set = make([]string, sz)
			for i := 0; i < sz; i++ {
				p.Set[i], l, err = x.ReadString(b[off:])
				off += l
				if err != nil {
					goto ReadFieldError
				}
			}
		case 0x80b: // p.ConstString ID:8 thrift.STRING
			p.ConstString, l, err = x.ReadString(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		case 0x908: // p.Enum ID:9 thrift.I32
			enum, l, err = x.ReadI32(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
			p.Enum = FOO(enum)
		default:
			l, err = x.Skip(b[off:], ftyp)
			off += l
			if err != nil {
				goto SkipFieldError
			}
		}
	}
	return
ReadFieldBeginError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field begin error: ", p), err)
ReadFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fid, fieldIDToName_ExampleDefaultValue[fid]), err)
SkipFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T skip field %d type %d error: ", p, fid, ftyp), err)
}

func (p *DeepRef) BLength() int {
	if p == nil {
		return 1
	}
	off := 0

	// p.DeepRef ID:1 thrift.STRUCT
	off += 3
	off += p.DeepRef.BLength()
	return off + 1
}

func (p *DeepRef) FastWrite(b []byte) int { return p.FastWriteNocopy(b, nil) }

func (p *DeepRef) FastWriteNocopy(b []byte, w thrift.NocopyWriter) int {
	if p == nil {
		b[0] = 0
		return 1
	}
	off := 0

	// p.DeepRef ID:1 thrift.STRUCT
	b[off] = 12
	binary.BigEndian.PutUint16(b[off+1:], 1)
	off += 3
	off += p.DeepRef.FastWriteNocopy(b[off:], w)

	b[off] = 0
	return off + 1
}

func (p *DeepRef) FastRead(b []byte) (off int, err error) {
	var ftyp thrift.TType
	var fid int16
	var l int
	x := thrift.BinaryProtocol{}
	for {
		ftyp, fid, l, err = x.ReadFieldBegin(b[off:])
		off += l
		if err != nil {
			goto ReadFieldBeginError
		}
		if ftyp == thrift.STOP {
			break
		}
		switch uint32(fid)<<8 | uint32(ftyp) {
		case 0x10c: // p.DeepRef ID:1 thrift.STRUCT
			p.DeepRef = deep.NewTestStruct()
			l, err = p.DeepRef.FastRead(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		default:
			l, err = x.Skip(b[off:], ftyp)
			off += l
			if err != nil {
				goto SkipFieldError
			}
		}
	}
	return
ReadFieldBeginError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field begin error: ", p), err)
ReadFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fid, fieldIDToName_DeepRef[fid]), err)
SkipFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T skip field %d type %d error: ", p, fid, ftyp), err)
}

func (p *Exception) BLength() int {
	if p == nil {
		return 1
	}
	off := 0

	// p.Code ID:1 thrift.I32
	off += 3
	off += 4

	// p.Msg ID:255 thrift.STRING
	off += 3
	off += 4 + len(p.Msg)
	return off + 1
}

func (p *Exception) FastWrite(b []byte) int { return p.FastWriteNocopy(b, nil) }

func (p *Exception) FastWriteNocopy(b []byte, w thrift.NocopyWriter) int {
	if p == nil {
		b[0] = 0
		return 1
	}
	off := 0

	// p.Code ID:1 thrift.I32
	b[off] = 8
	binary.BigEndian.PutUint16(b[off+1:], 1)
	off += 3
	binary.BigEndian.PutUint32(b[off:], uint32(p.Code))
	off += 4

	// p.Msg ID:255 thrift.STRING
	b[off] = 11
	binary.BigEndian.PutUint16(b[off+1:], 255)
	off += 3
	off += thrift.Binary.WriteStringNocopy(b[off:], w, p.Msg)

	b[off] = 0
	return off + 1
}

func (p *Exception) FastRead(b []byte) (off int, err error) {
	var ftyp thrift.TType
	var fid int16
	var l int
	x := thrift.BinaryProtocol{}
	for {
		ftyp, fid, l, err = x.ReadFieldBegin(b[off:])
		off += l
		if err != nil {
			goto ReadFieldBeginError
		}
		if ftyp == thrift.STOP {
			break
		}
		switch uint32(fid)<<8 | uint32(ftyp) {
		case 0x108: // p.Code ID:1 thrift.I32
			p.Code, l, err = x.ReadI32(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		case 0xff0b: // p.Msg ID:255 thrift.STRING
			p.Msg, l, err = x.ReadString(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		default:
			l, err = x.Skip(b[off:], ftyp)
			off += l
			if err != nil {
				goto SkipFieldError
			}
		}
	}
	return
ReadFieldBeginError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field begin error: ", p), err)
ReadFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fid, fieldIDToName_Exception[fid]), err)
SkipFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T skip field %d type %d error: ", p, fid, ftyp), err)
}

func (p *ExampleServiceExampleDeepRefArgs) BLength() int {
	if p == nil {
		return 1
	}
	off := 0

	// p.Req ID:1 thrift.STRUCT
	off += 3
	off += p.Req.BLength()
	return off + 1
}

func (p *ExampleServiceExampleDeepRefArgs) FastWrite(b []byte) int { return p.FastWriteNocopy(b, nil) }

func (p *ExampleServiceExampleDeepRefArgs) FastWriteNocopy(b []byte, w thrift.NocopyWriter) int {
	if p == nil {
		b[0] = 0
		return 1
	}
	off := 0

	// p.Req ID:1 thrift.STRUCT
	b[off] = 12
	binary.BigEndian.PutUint16(b[off+1:], 1)
	off += 3
	off += p.Req.FastWriteNocopy(b[off:], w)

	b[off] = 0
	return off + 1
}

func (p *ExampleServiceExampleDeepRefArgs) FastRead(b []byte) (off int, err error) {
	var ftyp thrift.TType
	var fid int16
	var l int
	x := thrift.BinaryProtocol{}
	for {
		ftyp, fid, l, err = x.ReadFieldBegin(b[off:])
		off += l
		if err != nil {
			goto ReadFieldBeginError
		}
		if ftyp == thrift.STOP {
			break
		}
		switch uint32(fid)<<8 | uint32(ftyp) {
		case 0x10c: // p.Req ID:1 thrift.STRUCT
			p.Req = NewDeepRef()
			l, err = p.Req.FastRead(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		default:
			l, err = x.Skip(b[off:], ftyp)
			off += l
			if err != nil {
				goto SkipFieldError
			}
		}
	}
	return
ReadFieldBeginError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field begin error: ", p), err)
ReadFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fid, fieldIDToName_ExampleServiceExampleDeepRefArgs[fid]), err)
SkipFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T skip field %d type %d error: ", p, fid, ftyp), err)
}

func (p *ExampleServiceExampleDeepRefResult) BLength() int {
	if p == nil {
		return 1
	}
	off := 0

	// p.Success ID:0 thrift.STRUCT
	if p.Success != nil {
		off += 3
		off += p.Success.BLength()
	}
	return off + 1
}

func (p *ExampleServiceExampleDeepRefResult) FastWrite(b []byte) int {
	return p.FastWriteNocopy(b, nil)
}

func (p *ExampleServiceExampleDeepRefResult) FastWriteNocopy(b []byte, w thrift.NocopyWriter) int {
	if p == nil {
		b[0] = 0
		return 1
	}
	off := 0

	// p.Success ID:0 thrift.STRUCT
	if p.Success != nil {
		b[off] = 12
		binary.BigEndian.PutUint16(b[off+1:], 0)
		off += 3
		off += p.Success.FastWriteNocopy(b[off:], w)
	}

	b[off] = 0
	return off + 1
}

func (p *ExampleServiceExampleDeepRefResult) FastRead(b []byte) (off int, err error) {
	var ftyp thrift.TType
	var fid int16
	var l int
	x := thrift.BinaryProtocol{}
	for {
		ftyp, fid, l, err = x.ReadFieldBegin(b[off:])
		off += l
		if err != nil {
			goto ReadFieldBeginError
		}
		if ftyp == thrift.STOP {
			break
		}
		switch uint32(fid)<<8 | uint32(ftyp) {
		case 0xc: // p.Success ID:0 thrift.STRUCT
			p.Success = NewDeepRef()
			l, err = p.Success.FastRead(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		default:
			l, err = x.Skip(b[off:], ftyp)
			off += l
			if err != nil {
				goto SkipFieldError
			}
		}
	}
	return
ReadFieldBeginError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field begin error: ", p), err)
ReadFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fid, fieldIDToName_ExampleServiceExampleDeepRefResult[fid]), err)
SkipFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T skip field %d type %d error: ", p, fid, ftyp), err)
}

func (p *ExampleServiceExampleMethodArgs) BLength() int {
	if p == nil {
		return 1
	}
	off := 0

	// p.Req ID:1 thrift.STRUCT
	off += 3
	off += p.Req.BLength()
	return off + 1
}

func (p *ExampleServiceExampleMethodArgs) FastWrite(b []byte) int { return p.FastWriteNocopy(b, nil) }

func (p *ExampleServiceExampleMethodArgs) FastWriteNocopy(b []byte, w thrift.NocopyWriter) int {
	if p == nil {
		b[0] = 0
		return 1
	}
	off := 0

	// p.Req ID:1 thrift.STRUCT
	b[off] = 12
	binary.BigEndian.PutUint16(b[off+1:], 1)
	off += 3
	off += p.Req.FastWriteNocopy(b[off:], w)

	b[off] = 0
	return off + 1
}

func (p *ExampleServiceExampleMethodArgs) FastRead(b []byte) (off int, err error) {
	var ftyp thrift.TType
	var fid int16
	var l int
	x := thrift.BinaryProtocol{}
	for {
		ftyp, fid, l, err = x.ReadFieldBegin(b[off:])
		off += l
		if err != nil {
			goto ReadFieldBeginError
		}
		if ftyp == thrift.STOP {
			break
		}
		switch uint32(fid)<<8 | uint32(ftyp) {
		case 0x10c: // p.Req ID:1 thrift.STRUCT
			p.Req = NewExampleReq()
			l, err = p.Req.FastRead(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		default:
			l, err = x.Skip(b[off:], ftyp)
			off += l
			if err != nil {
				goto SkipFieldError
			}
		}
	}
	return
ReadFieldBeginError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field begin error: ", p), err)
ReadFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fid, fieldIDToName_ExampleServiceExampleMethodArgs[fid]), err)
SkipFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T skip field %d type %d error: ", p, fid, ftyp), err)
}

func (p *ExampleServiceExampleMethodResult) BLength() int {
	if p == nil {
		return 1
	}
	off := 0

	// p.Success ID:0 thrift.STRUCT
	if p.Success != nil {
		off += 3
		off += p.Success.BLength()
	}

	// p.Err ID:1 thrift.STRUCT
	if p.Err != nil {
		off += 3
		off += p.Err.BLength()
	}
	return off + 1
}

func (p *ExampleServiceExampleMethodResult) FastWrite(b []byte) int { return p.FastWriteNocopy(b, nil) }

func (p *ExampleServiceExampleMethodResult) FastWriteNocopy(b []byte, w thrift.NocopyWriter) int {
	if p == nil {
		b[0] = 0
		return 1
	}
	off := 0

	// p.Success ID:0 thrift.STRUCT
	if p.Success != nil {
		b[off] = 12
		binary.BigEndian.PutUint16(b[off+1:], 0)
		off += 3
		off += p.Success.FastWriteNocopy(b[off:], w)
	}

	// p.Err ID:1 thrift.STRUCT
	if p.Err != nil {
		b[off] = 12
		binary.BigEndian.PutUint16(b[off+1:], 1)
		off += 3
		off += p.Err.FastWriteNocopy(b[off:], w)
	}

	b[off] = 0
	return off + 1
}

func (p *ExampleServiceExampleMethodResult) FastRead(b []byte) (off int, err error) {
	var ftyp thrift.TType
	var fid int16
	var l int
	x := thrift.BinaryProtocol{}
	for {
		ftyp, fid, l, err = x.ReadFieldBegin(b[off:])
		off += l
		if err != nil {
			goto ReadFieldBeginError
		}
		if ftyp == thrift.STOP {
			break
		}
		switch uint32(fid)<<8 | uint32(ftyp) {
		case 0xc: // p.Success ID:0 thrift.STRUCT
			p.Success = NewExampleResp()
			l, err = p.Success.FastRead(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		case 0x10c: // p.Err ID:1 thrift.STRUCT
			p.Err = NewException()
			l, err = p.Err.FastRead(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		default:
			l, err = x.Skip(b[off:], ftyp)
			off += l
			if err != nil {
				goto SkipFieldError
			}
		}
	}
	return
ReadFieldBeginError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field begin error: ", p), err)
ReadFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fid, fieldIDToName_ExampleServiceExampleMethodResult[fid]), err)
SkipFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T skip field %d type %d error: ", p, fid, ftyp), err)
}

func (p *ExampleServiceFooArgs) BLength() int {
	if p == nil {
		return 1
	}
	off := 0

	// p.Req ID:1 thrift.STRUCT
	off += 3
	off += p.Req.BLength()
	return off + 1
}

func (p *ExampleServiceFooArgs) FastWrite(b []byte) int { return p.FastWriteNocopy(b, nil) }

func (p *ExampleServiceFooArgs) FastWriteNocopy(b []byte, w thrift.NocopyWriter) int {
	if p == nil {
		b[0] = 0
		return 1
	}
	off := 0

	// p.Req ID:1 thrift.STRUCT
	b[off] = 12
	binary.BigEndian.PutUint16(b[off+1:], 1)
	off += 3
	off += p.Req.FastWriteNocopy(b[off:], w)

	b[off] = 0
	return off + 1
}

func (p *ExampleServiceFooArgs) FastRead(b []byte) (off int, err error) {
	var ftyp thrift.TType
	var fid int16
	var l int
	x := thrift.BinaryProtocol{}
	for {
		ftyp, fid, l, err = x.ReadFieldBegin(b[off:])
		off += l
		if err != nil {
			goto ReadFieldBeginError
		}
		if ftyp == thrift.STOP {
			break
		}
		switch uint32(fid)<<8 | uint32(ftyp) {
		case 0x10c: // p.Req ID:1 thrift.STRUCT
			p.Req = NewA()
			l, err = p.Req.FastRead(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		default:
			l, err = x.Skip(b[off:], ftyp)
			off += l
			if err != nil {
				goto SkipFieldError
			}
		}
	}
	return
ReadFieldBeginError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field begin error: ", p), err)
ReadFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fid, fieldIDToName_ExampleServiceFooArgs[fid]), err)
SkipFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T skip field %d type %d error: ", p, fid, ftyp), err)
}

func (p *ExampleServiceFooResult) BLength() int {
	if p == nil {
		return 1
	}
	off := 0

	// p.Success ID:0 thrift.STRUCT
	if p.Success != nil {
		off += 3
		off += p.Success.BLength()
	}
	return off + 1
}

func (p *ExampleServiceFooResult) FastWrite(b []byte) int { return p.FastWriteNocopy(b, nil) }

func (p *ExampleServiceFooResult) FastWriteNocopy(b []byte, w thrift.NocopyWriter) int {
	if p == nil {
		b[0] = 0
		return 1
	}
	off := 0

	// p.Success ID:0 thrift.STRUCT
	if p.Success != nil {
		b[off] = 12
		binary.BigEndian.PutUint16(b[off+1:], 0)
		off += 3
		off += p.Success.FastWriteNocopy(b[off:], w)
	}

	b[off] = 0
	return off + 1
}

func (p *ExampleServiceFooResult) FastRead(b []byte) (off int, err error) {
	var ftyp thrift.TType
	var fid int16
	var l int
	x := thrift.BinaryProtocol{}
	for {
		ftyp, fid, l, err = x.ReadFieldBegin(b[off:])
		off += l
		if err != nil {
			goto ReadFieldBeginError
		}
		if ftyp == thrift.STOP {
			break
		}
		switch uint32(fid)<<8 | uint32(ftyp) {
		case 0xc: // p.Success ID:0 thrift.STRUCT
			p.Success = NewA()
			l, err = p.Success.FastRead(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		default:
			l, err = x.Skip(b[off:], ftyp)
			off += l
			if err != nil {
				goto SkipFieldError
			}
		}
	}
	return
ReadFieldBeginError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field begin error: ", p), err)
ReadFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fid, fieldIDToName_ExampleServiceFooResult[fid]), err)
SkipFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T skip field %d type %d error: ", p, fid, ftyp), err)
}

func (p *ExampleServicePingArgs) BLength() int {
	if p == nil {
		return 1
	}
	off := 0

	// p.Msg ID:1 thrift.STRING
	off += 3
	off += 4 + len(p.Msg)
	return off + 1
}

func (p *ExampleServicePingArgs) FastWrite(b []byte) int { return p.FastWriteNocopy(b, nil) }

func (p *ExampleServicePingArgs) FastWriteNocopy(b []byte, w thrift.NocopyWriter) int {
	if p == nil {
		b[0] = 0
		return 1
	}
	off := 0

	// p.Msg ID:1 thrift.STRING
	b[off] = 11
	binary.BigEndian.PutUint16(b[off+1:], 1)
	off += 3
	off += thrift.Binary.WriteStringNocopy(b[off:], w, p.Msg)

	b[off] = 0
	return off + 1
}

func (p *ExampleServicePingArgs) FastRead(b []byte) (off int, err error) {
	var ftyp thrift.TType
	var fid int16
	var l int
	x := thrift.BinaryProtocol{}
	for {
		ftyp, fid, l, err = x.ReadFieldBegin(b[off:])
		off += l
		if err != nil {
			goto ReadFieldBeginError
		}
		if ftyp == thrift.STOP {
			break
		}
		switch uint32(fid)<<8 | uint32(ftyp) {
		case 0x10b: // p.Msg ID:1 thrift.STRING
			p.Msg, l, err = x.ReadString(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		default:
			l, err = x.Skip(b[off:], ftyp)
			off += l
			if err != nil {
				goto SkipFieldError
			}
		}
	}
	return
ReadFieldBeginError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field begin error: ", p), err)
ReadFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fid, fieldIDToName_ExampleServicePingArgs[fid]), err)
SkipFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T skip field %d type %d error: ", p, fid, ftyp), err)
}

func (p *ExampleServicePingResult) BLength() int {
	if p == nil {
		return 1
	}
	off := 0

	// p.Success ID:0 thrift.STRING
	if p.Success != nil {
		off += 3
		off += 4 + len(*p.Success)
	}
	return off + 1
}

func (p *ExampleServicePingResult) FastWrite(b []byte) int { return p.FastWriteNocopy(b, nil) }

func (p *ExampleServicePingResult) FastWriteNocopy(b []byte, w thrift.NocopyWriter) int {
	if p == nil {
		b[0] = 0
		return 1
	}
	off := 0

	// p.Success ID:0 thrift.STRING
	if p.Success != nil {
		b[off] = 11
		binary.BigEndian.PutUint16(b[off+1:], 0)
		off += 3
		off += thrift.Binary.WriteStringNocopy(b[off:], w, *p.Success)
	}

	b[off] = 0
	return off + 1
}

func (p *ExampleServicePingResult) FastRead(b []byte) (off int, err error) {
	var ftyp thrift.TType
	var fid int16
	var l int
	x := thrift.BinaryProtocol{}
	for {
		ftyp, fid, l, err = x.ReadFieldBegin(b[off:])
		off += l
		if err != nil {
			goto ReadFieldBeginError
		}
		if ftyp == thrift.STOP {
			break
		}
		switch uint32(fid)<<8 | uint32(ftyp) {
		case 0xb: // p.Success ID:0 thrift.STRING
			if p.Success == nil {
				p.Success = new(string)
			}
			*p.Success, l, err = x.ReadString(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		default:
			l, err = x.Skip(b[off:], ftyp)
			off += l
			if err != nil {
				goto SkipFieldError
			}
		}
	}
	return
ReadFieldBeginError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field begin error: ", p), err)
ReadFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fid, fieldIDToName_ExampleServicePingResult[fid]), err)
SkipFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T skip field %d type %d error: ", p, fid, ftyp), err)
}

func (p *ExampleServiceOnewayArgs) BLength() int {
	if p == nil {
		return 1
	}
	off := 0

	// p.Msg ID:1 thrift.STRING
	off += 3
	off += 4 + len(p.Msg)
	return off + 1
}

func (p *ExampleServiceOnewayArgs) FastWrite(b []byte) int { return p.FastWriteNocopy(b, nil) }

func (p *ExampleServiceOnewayArgs) FastWriteNocopy(b []byte, w thrift.NocopyWriter) int {
	if p == nil {
		b[0] = 0
		return 1
	}
	off := 0

	// p.Msg ID:1 thrift.STRING
	b[off] = 11
	binary.BigEndian.PutUint16(b[off+1:], 1)
	off += 3
	off += thrift.Binary.WriteStringNocopy(b[off:], w, p.Msg)

	b[off] = 0
	return off + 1
}

func (p *ExampleServiceOnewayArgs) FastRead(b []byte) (off int, err error) {
	var ftyp thrift.TType
	var fid int16
	var l int
	x := thrift.BinaryProtocol{}
	for {
		ftyp, fid, l, err = x.ReadFieldBegin(b[off:])
		off += l
		if err != nil {
			goto ReadFieldBeginError
		}
		if ftyp == thrift.STOP {
			break
		}
		switch uint32(fid)<<8 | uint32(ftyp) {
		case 0x10b: // p.Msg ID:1 thrift.STRING
			p.Msg, l, err = x.ReadString(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		default:
			l, err = x.Skip(b[off:], ftyp)
			off += l
			if err != nil {
				goto SkipFieldError
			}
		}
	}
	return
ReadFieldBeginError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field begin error: ", p), err)
ReadFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fid, fieldIDToName_ExampleServiceOnewayArgs[fid]), err)
SkipFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T skip field %d type %d error: ", p, fid, ftyp), err)
}

func (p *ExampleServiceVoidArgs) BLength() int {
	if p == nil {
		return 1
	}
	off := 0

	// p.Msg ID:1 thrift.STRING
	off += 3
	off += 4 + len(p.Msg)
	return off + 1
}

func (p *ExampleServiceVoidArgs) FastWrite(b []byte) int { return p.FastWriteNocopy(b, nil) }

func (p *ExampleServiceVoidArgs) FastWriteNocopy(b []byte, w thrift.NocopyWriter) int {
	if p == nil {
		b[0] = 0
		return 1
	}
	off := 0

	// p.Msg ID:1 thrift.STRING
	b[off] = 11
	binary.BigEndian.PutUint16(b[off+1:], 1)
	off += 3
	off += thrift.Binary.WriteStringNocopy(b[off:], w, p.Msg)

	b[off] = 0
	return off + 1
}

func (p *ExampleServiceVoidArgs) FastRead(b []byte) (off int, err error) {
	var ftyp thrift.TType
	var fid int16
	var l int
	x := thrift.BinaryProtocol{}
	for {
		ftyp, fid, l, err = x.ReadFieldBegin(b[off:])
		off += l
		if err != nil {
			goto ReadFieldBeginError
		}
		if ftyp == thrift.STOP {
			break
		}
		switch uint32(fid)<<8 | uint32(ftyp) {
		case 0x10b: // p.Msg ID:1 thrift.STRING
			p.Msg, l, err = x.ReadString(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		default:
			l, err = x.Skip(b[off:], ftyp)
			off += l
			if err != nil {
				goto SkipFieldError
			}
		}
	}
	return
ReadFieldBeginError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field begin error: ", p), err)
ReadFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fid, fieldIDToName_ExampleServiceVoidArgs[fid]), err)
SkipFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T skip field %d type %d error: ", p, fid, ftyp), err)
}

func (p *ExampleServiceVoidResult) BLength() int {
	if p == nil {
		return 1
	}
	off := 0
	return off + 1
}

func (p *ExampleServiceVoidResult) FastWrite(b []byte) int { return p.FastWriteNocopy(b, nil) }

func (p *ExampleServiceVoidResult) FastWriteNocopy(b []byte, w thrift.NocopyWriter) int {
	if p == nil {
		b[0] = 0
		return 1
	}
	off := 0

	b[off] = 0
	return off + 1
}

func (p *ExampleServiceVoidResult) FastRead(b []byte) (off int, err error) {
	var ftyp thrift.TType
	var fid int16
	var l int
	x := thrift.BinaryProtocol{}
	for {
		ftyp, fid, l, err = x.ReadFieldBegin(b[off:])
		off += l
		if err != nil {
			goto ReadFieldBeginError
		}
		if ftyp == thrift.STOP {
			break
		}
		switch uint32(fid)<<8 | uint32(ftyp) {
		default:
			l, err = x.Skip(b[off:], ftyp)
			off += l
			if err != nil {
				goto SkipFieldError
			}
		}
	}
	return
ReadFieldBeginError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field begin error: ", p), err)
SkipFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T skip field %d type %d error: ", p, fid, ftyp), err)
}

func (p *ExampleServiceExampleToSnakeCaseArgs) BLength() int {
	if p == nil {
		return 1
	}
	off := 0

	// p.Req ID:1 thrift.STRUCT
	off += 3
	off += p.Req.BLength()
	return off + 1
}

func (p *ExampleServiceExampleToSnakeCaseArgs) FastWrite(b []byte) int {
	return p.FastWriteNocopy(b, nil)
}

func (p *ExampleServiceExampleToSnakeCaseArgs) FastWriteNocopy(b []byte, w thrift.NocopyWriter) int {
	if p == nil {
		b[0] = 0
		return 1
	}
	off := 0

	// p.Req ID:1 thrift.STRUCT
	b[off] = 12
	binary.BigEndian.PutUint16(b[off+1:], 1)
	off += 3
	off += p.Req.FastWriteNocopy(b[off:], w)

	b[off] = 0
	return off + 1
}

func (p *ExampleServiceExampleToSnakeCaseArgs) FastRead(b []byte) (off int, err error) {
	var ftyp thrift.TType
	var fid int16
	var l int
	x := thrift.BinaryProtocol{}
	for {
		ftyp, fid, l, err = x.ReadFieldBegin(b[off:])
		off += l
		if err != nil {
			goto ReadFieldBeginError
		}
		if ftyp == thrift.STOP {
			break
		}
		switch uint32(fid)<<8 | uint32(ftyp) {
		case 0x10c: // p.Req ID:1 thrift.STRUCT
			p.Req = NewExampleToSnakeCase()
			l, err = p.Req.FastRead(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		default:
			l, err = x.Skip(b[off:], ftyp)
			off += l
			if err != nil {
				goto SkipFieldError
			}
		}
	}
	return
ReadFieldBeginError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field begin error: ", p), err)
ReadFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fid, fieldIDToName_ExampleServiceExampleToSnakeCaseArgs[fid]), err)
SkipFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T skip field %d type %d error: ", p, fid, ftyp), err)
}

func (p *ExampleServiceExampleToSnakeCaseResult) BLength() int {
	if p == nil {
		return 1
	}
	off := 0
	return off + 1
}

func (p *ExampleServiceExampleToSnakeCaseResult) FastWrite(b []byte) int {
	return p.FastWriteNocopy(b, nil)
}

func (p *ExampleServiceExampleToSnakeCaseResult) FastWriteNocopy(b []byte, w thrift.NocopyWriter) int {
	if p == nil {
		b[0] = 0
		return 1
	}
	off := 0

	b[off] = 0
	return off + 1
}

func (p *ExampleServiceExampleToSnakeCaseResult) FastRead(b []byte) (off int, err error) {
	var ftyp thrift.TType
	var fid int16
	var l int
	x := thrift.BinaryProtocol{}
	for {
		ftyp, fid, l, err = x.ReadFieldBegin(b[off:])
		off += l
		if err != nil {
			goto ReadFieldBeginError
		}
		if ftyp == thrift.STOP {
			break
		}
		switch uint32(fid)<<8 | uint32(ftyp) {
		default:
			l, err = x.Skip(b[off:], ftyp)
			off += l
			if err != nil {
				goto SkipFieldError
			}
		}
	}
	return
ReadFieldBeginError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field begin error: ", p), err)
SkipFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T skip field %d type %d error: ", p, fid, ftyp), err)
}

func (p *ExampleServiceExampleDefaultValueArgs) BLength() int {
	if p == nil {
		return 1
	}
	off := 0

	// p.Req ID:1 thrift.STRUCT
	off += 3
	off += p.Req.BLength()
	return off + 1
}

func (p *ExampleServiceExampleDefaultValueArgs) FastWrite(b []byte) int {
	return p.FastWriteNocopy(b, nil)
}

func (p *ExampleServiceExampleDefaultValueArgs) FastWriteNocopy(b []byte, w thrift.NocopyWriter) int {
	if p == nil {
		b[0] = 0
		return 1
	}
	off := 0

	// p.Req ID:1 thrift.STRUCT
	b[off] = 12
	binary.BigEndian.PutUint16(b[off+1:], 1)
	off += 3
	off += p.Req.FastWriteNocopy(b[off:], w)

	b[off] = 0
	return off + 1
}

func (p *ExampleServiceExampleDefaultValueArgs) FastRead(b []byte) (off int, err error) {
	var ftyp thrift.TType
	var fid int16
	var l int
	x := thrift.BinaryProtocol{}
	for {
		ftyp, fid, l, err = x.ReadFieldBegin(b[off:])
		off += l
		if err != nil {
			goto ReadFieldBeginError
		}
		if ftyp == thrift.STOP {
			break
		}
		switch uint32(fid)<<8 | uint32(ftyp) {
		case 0x10c: // p.Req ID:1 thrift.STRUCT
			p.Req = NewExampleDefaultValue()
			l, err = p.Req.FastRead(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		default:
			l, err = x.Skip(b[off:], ftyp)
			off += l
			if err != nil {
				goto SkipFieldError
			}
		}
	}
	return
ReadFieldBeginError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field begin error: ", p), err)
ReadFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fid, fieldIDToName_ExampleServiceExampleDefaultValueArgs[fid]), err)
SkipFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T skip field %d type %d error: ", p, fid, ftyp), err)
}

func (p *ExampleServiceExampleDefaultValueResult) BLength() int {
	if p == nil {
		return 1
	}
	off := 0

	// p.Success ID:0 thrift.STRUCT
	if p.Success != nil {
		off += 3
		off += p.Success.BLength()
	}
	return off + 1
}

func (p *ExampleServiceExampleDefaultValueResult) FastWrite(b []byte) int {
	return p.FastWriteNocopy(b, nil)
}

func (p *ExampleServiceExampleDefaultValueResult) FastWriteNocopy(b []byte, w thrift.NocopyWriter) int {
	if p == nil {
		b[0] = 0
		return 1
	}
	off := 0

	// p.Success ID:0 thrift.STRUCT
	if p.Success != nil {
		b[off] = 12
		binary.BigEndian.PutUint16(b[off+1:], 0)
		off += 3
		off += p.Success.FastWriteNocopy(b[off:], w)
	}

	b[off] = 0
	return off + 1
}

func (p *ExampleServiceExampleDefaultValueResult) FastRead(b []byte) (off int, err error) {
	var ftyp thrift.TType
	var fid int16
	var l int
	x := thrift.BinaryProtocol{}
	for {
		ftyp, fid, l, err = x.ReadFieldBegin(b[off:])
		off += l
		if err != nil {
			goto ReadFieldBeginError
		}
		if ftyp == thrift.STOP {
			break
		}
		switch uint32(fid)<<8 | uint32(ftyp) {
		case 0xc: // p.Success ID:0 thrift.STRUCT
			p.Success = NewExampleDefaultValue()
			l, err = p.Success.FastRead(b[off:])
			off += l
			if err != nil {
				goto ReadFieldError
			}
		default:
			l, err = x.Skip(b[off:], ftyp)
			off += l
			if err != nil {
				goto SkipFieldError
			}
		}
	}
	return
ReadFieldBeginError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field begin error: ", p), err)
ReadFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fid, fieldIDToName_ExampleServiceExampleDefaultValueResult[fid]), err)
SkipFieldError:
	return off, thrift.PrependError(fmt.Sprintf("%T skip field %d type %d error: ", p, fid, ftyp), err)
}
