// Copyright 2018 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// Code generated by generate-types. DO NOT EDIT.

package proto

import (
	
	

	
	
	
	
)

var wireTypes = map[protoreflect.Kind]protowire.Type{
	protoreflect.BoolKind:     protowire.VarintType,
	protoreflect.EnumKind:     protowire.VarintType,
	protoreflect.Int32Kind:    protowire.VarintType,
	protoreflect.Sint32Kind:   protowire.VarintType,
	protoreflect.Uint32Kind:   protowire.VarintType,
	protoreflect.Int64Kind:    protowire.VarintType,
	protoreflect.Sint64Kind:   protowire.VarintType,
	protoreflect.Uint64Kind:   protowire.VarintType,
	protoreflect.Sfixed32Kind: protowire.Fixed32Type,
	protoreflect.Fixed32Kind:  protowire.Fixed32Type,
	protoreflect.FloatKind:    protowire.Fixed32Type,
	protoreflect.Sfixed64Kind: protowire.Fixed64Type,
	protoreflect.Fixed64Kind:  protowire.Fixed64Type,
	protoreflect.DoubleKind:   protowire.Fixed64Type,
	protoreflect.StringKind:   protowire.BytesType,
	protoreflect.BytesKind:    protowire.BytesType,
	protoreflect.MessageKind:  protowire.BytesType,
	protoreflect.GroupKind:    protowire.StartGroupType,
}

func ( MarshalOptions) ( []byte,  protoreflect.FieldDescriptor,  protoreflect.Value) ([]byte, error) {
	switch .Kind() {
	case protoreflect.BoolKind:
		 = protowire.AppendVarint(, protowire.EncodeBool(.Bool()))
	case protoreflect.EnumKind:
		 = protowire.AppendVarint(, uint64(.Enum()))
	case protoreflect.Int32Kind:
		 = protowire.AppendVarint(, uint64(int32(.Int())))
	case protoreflect.Sint32Kind:
		 = protowire.AppendVarint(, protowire.EncodeZigZag(int64(int32(.Int()))))
	case protoreflect.Uint32Kind:
		 = protowire.AppendVarint(, uint64(uint32(.Uint())))
	case protoreflect.Int64Kind:
		 = protowire.AppendVarint(, uint64(.Int()))
	case protoreflect.Sint64Kind:
		 = protowire.AppendVarint(, protowire.EncodeZigZag(.Int()))
	case protoreflect.Uint64Kind:
		 = protowire.AppendVarint(, .Uint())
	case protoreflect.Sfixed32Kind:
		 = protowire.AppendFixed32(, uint32(.Int()))
	case protoreflect.Fixed32Kind:
		 = protowire.AppendFixed32(, uint32(.Uint()))
	case protoreflect.FloatKind:
		 = protowire.AppendFixed32(, math.Float32bits(float32(.Float())))
	case protoreflect.Sfixed64Kind:
		 = protowire.AppendFixed64(, uint64(.Int()))
	case protoreflect.Fixed64Kind:
		 = protowire.AppendFixed64(, .Uint())
	case protoreflect.DoubleKind:
		 = protowire.AppendFixed64(, math.Float64bits(.Float()))
	case protoreflect.StringKind:
		if strs.EnforceUTF8() && !utf8.ValidString(.String()) {
			return , errors.InvalidUTF8(string(.FullName()))
		}
		 = protowire.AppendString(, .String())
	case protoreflect.BytesKind:
		 = protowire.AppendBytes(, .Bytes())
	case protoreflect.MessageKind:
		var  int
		var  error
		,  = appendSpeculativeLength()
		,  = .marshalMessage(, .Message())
		if  != nil {
			return , 
		}
		 = finishSpeculativeLength(, )
	case protoreflect.GroupKind:
		var  error
		,  = .marshalMessage(, .Message())
		if  != nil {
			return , 
		}
		 = protowire.AppendVarint(, protowire.EncodeTag(.Number(), protowire.EndGroupType))
	default:
		return , errors.New("invalid kind %v", .Kind())
	}
	return , nil
}