// 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 impl

import (
	

	
)

func ( protoreflect.FieldDescriptor,  reflect.StructField,  Converter,  offset) func( pointer) protoreflect.Value {
	 := .Type
	if .Kind() == reflect.Ptr {
		 = .Elem()
	}
	if .Kind() == protoreflect.EnumKind {
		 := .Type.Elem()
		// Enums for nullable types.
		return func( pointer) protoreflect.Value {
			if .IsNil() {
				return .Zero()
			}
			 := .Apply().Elem().AsValueOf()
			if .IsNil() {
				return .Zero()
			}
			return .PBValueOf(.Elem())
		}
	}
	switch .Kind() {
	case reflect.Bool:
		return func( pointer) protoreflect.Value {
			if .IsNil() {
				return .Zero()
			}
			 := .Apply().BoolPtr()
			if * == nil {
				return .Zero()
			}
			return protoreflect.ValueOfBool(**)
		}
	case reflect.Int32:
		return func( pointer) protoreflect.Value {
			if .IsNil() {
				return .Zero()
			}
			 := .Apply().Int32Ptr()
			if * == nil {
				return .Zero()
			}
			return protoreflect.ValueOfInt32(**)
		}
	case reflect.Uint32:
		return func( pointer) protoreflect.Value {
			if .IsNil() {
				return .Zero()
			}
			 := .Apply().Uint32Ptr()
			if * == nil {
				return .Zero()
			}
			return protoreflect.ValueOfUint32(**)
		}
	case reflect.Int64:
		return func( pointer) protoreflect.Value {
			if .IsNil() {
				return .Zero()
			}
			 := .Apply().Int64Ptr()
			if * == nil {
				return .Zero()
			}
			return protoreflect.ValueOfInt64(**)
		}
	case reflect.Uint64:
		return func( pointer) protoreflect.Value {
			if .IsNil() {
				return .Zero()
			}
			 := .Apply().Uint64Ptr()
			if * == nil {
				return .Zero()
			}
			return protoreflect.ValueOfUint64(**)
		}
	case reflect.Float32:
		return func( pointer) protoreflect.Value {
			if .IsNil() {
				return .Zero()
			}
			 := .Apply().Float32Ptr()
			if * == nil {
				return .Zero()
			}
			return protoreflect.ValueOfFloat32(**)
		}
	case reflect.Float64:
		return func( pointer) protoreflect.Value {
			if .IsNil() {
				return .Zero()
			}
			 := .Apply().Float64Ptr()
			if * == nil {
				return .Zero()
			}
			return protoreflect.ValueOfFloat64(**)
		}
	case reflect.String:
		if .Kind() == protoreflect.BytesKind {
			return func( pointer) protoreflect.Value {
				if .IsNil() {
					return .Zero()
				}
				 := .Apply().StringPtr()
				if * == nil {
					return .Zero()
				}
				if len(**) == 0 {
					return protoreflect.ValueOfBytes(nil)
				}
				return protoreflect.ValueOfBytes([]byte(**))
			}
		}
		return func( pointer) protoreflect.Value {
			if .IsNil() {
				return .Zero()
			}
			 := .Apply().StringPtr()
			if * == nil {
				return .Zero()
			}
			return protoreflect.ValueOfString(**)
		}
	case reflect.Slice:
		if .Kind() == protoreflect.StringKind {
			return func( pointer) protoreflect.Value {
				if .IsNil() {
					return .Zero()
				}
				 := .Apply().Bytes()
				if len(*) == 0 {
					return .Zero()
				}
				return protoreflect.ValueOfString(string(*))
			}
		}
		return func( pointer) protoreflect.Value {
			if .IsNil() {
				return .Zero()
			}
			 := .Apply().Bytes()
			if * == nil {
				return .Zero()
			}
			return protoreflect.ValueOfBytes(*)
		}
	}
	panic("unexpected protobuf kind: " + .Kind().String())
}

func ( protoreflect.FieldDescriptor,  reflect.StructField,  Converter,  offset) func( pointer) protoreflect.Value {
	 := .Type
	if .Kind() == protoreflect.EnumKind {
		// Enums for non nullable types.
		return func( pointer) protoreflect.Value {
			if .IsNil() {
				return .Zero()
			}
			 := .Apply().AsValueOf(.Type).Elem()
			return .PBValueOf()
		}
	}
	switch .Kind() {
	case reflect.Bool:
		return func( pointer) protoreflect.Value {
			if .IsNil() {
				return .Zero()
			}
			 := .Apply().Bool()
			return protoreflect.ValueOfBool(*)
		}
	case reflect.Int32:
		return func( pointer) protoreflect.Value {
			if .IsNil() {
				return .Zero()
			}
			 := .Apply().Int32()
			return protoreflect.ValueOfInt32(*)
		}
	case reflect.Uint32:
		return func( pointer) protoreflect.Value {
			if .IsNil() {
				return .Zero()
			}
			 := .Apply().Uint32()
			return protoreflect.ValueOfUint32(*)
		}
	case reflect.Int64:
		return func( pointer) protoreflect.Value {
			if .IsNil() {
				return .Zero()
			}
			 := .Apply().Int64()
			return protoreflect.ValueOfInt64(*)
		}
	case reflect.Uint64:
		return func( pointer) protoreflect.Value {
			if .IsNil() {
				return .Zero()
			}
			 := .Apply().Uint64()
			return protoreflect.ValueOfUint64(*)
		}
	case reflect.Float32:
		return func( pointer) protoreflect.Value {
			if .IsNil() {
				return .Zero()
			}
			 := .Apply().Float32()
			return protoreflect.ValueOfFloat32(*)
		}
	case reflect.Float64:
		return func( pointer) protoreflect.Value {
			if .IsNil() {
				return .Zero()
			}
			 := .Apply().Float64()
			return protoreflect.ValueOfFloat64(*)
		}
	case reflect.String:
		if .Kind() == protoreflect.BytesKind {
			return func( pointer) protoreflect.Value {
				if .IsNil() {
					return .Zero()
				}
				 := .Apply().String()
				if len(*) == 0 {
					return protoreflect.ValueOfBytes(nil)
				}
				return protoreflect.ValueOfBytes([]byte(*))
			}
		}
		return func( pointer) protoreflect.Value {
			if .IsNil() {
				return .Zero()
			}
			 := .Apply().String()
			return protoreflect.ValueOfString(*)
		}
	case reflect.Slice:
		if .Kind() == protoreflect.StringKind {
			return func( pointer) protoreflect.Value {
				if .IsNil() {
					return .Zero()
				}
				 := .Apply().Bytes()
				return protoreflect.ValueOfString(string(*))
			}
		}
		return func( pointer) protoreflect.Value {
			if .IsNil() {
				return .Zero()
			}
			 := .Apply().Bytes()
			return protoreflect.ValueOfBytes(*)
		}
	}
	panic("unexpected protobuf kind: " + .Kind().String())
}