You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: decode_gen.go
    path of file: ./repos/streamdal/apps/server/vendor/google.golang.org/protobuf/proto
    
    the code of the file until where you have to start completion: // 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 (
	"math"
	"unicode/utf8"

	"google.golang.org/protobuf/encoding/protowire"
	"google.golang.org/protobuf/internal/errors"
	"google.golang.org/protobuf/internal/strs"
	"google.golang.org/protobuf/reflect/protoreflect"
)

// unmarshalScalar decodes a value of the given kind.
//
// Message values are decoded into a []byte which aliases the input data.
func (o UnmarshalOptions) unmarshalScalar(b []byte, wtyp protowire.Type, fd protoreflect.FieldDescriptor) (val protoreflect.Value, n int, err error) {
	switch fd.Kind() {
	case protoreflect.BoolKind:
		if wtyp != protowire.VarintType {
			return val, 0, errUnknown
		}
		v, n := protowire.ConsumeVarint(b)
		if n < 0 {
			return val, 0, errDecode
		}
		return protoreflect.ValueOfBool(protowire.DecodeBool(v)), n, nil
	case protoreflect.EnumKind:
		if wtyp != protowire.VarintType {
			return val, 0, errUnknown
		}
		v, n := protowire.ConsumeVarint(b)
		if n < 0 {
			return val, 0, errDecode
		}
		return protoreflect.ValueOfEnum(protoreflect.EnumNumber(v)), n, nil
	case protoreflect.Int32Kind:
		if wtyp != protowire.VarintType {
			return val, 0, errUnknown
		}
		v, n := protowire.ConsumeVarint(b)
		if n < 0 {
			return val, 0, errDecode
		}
		return protoreflect.ValueOfInt32(int32(v)), n, nil
	case protoreflect.Sint32Kind:
		if wtyp != protowire.VarintType {
			return val, 0, errUnknown
		}
		v, n := protowire.ConsumeVarint(b)
		if n < 0 {
			return val, 0, errDecode
		}
		return protoreflect.ValueOfInt32(int32(protowire.DecodeZigZag(v & math.MaxUint32))), n, nil
	case protoreflect.Uint32Kind:
		if wtyp != protowire.VarintType {
			return val, 0, errUnknown
		}
		v, n := protowire.ConsumeVarint(b)
		if n < 0 {
			return val, 0, errDecode
		}
		return protoreflect.ValueOfUint32(uint32(v)), n, nil
	case protoreflect.Int64Kind:
		if wtyp != protowire.VarintType {
			return val, 0, errUnknown
		}
		v, n := protowire.ConsumeVarint(b)
		if n < 0 {
			return val, 0, errDecode
		}
		return protoreflect.ValueOfInt64(int64(v)), n, nil
	case protoreflect.Sint64Kind:
		if wtyp != protowire.VarintType {
			return val, 0, errUnknown
		}
		v, n := protowire.ConsumeVarint(b)
		if n < 0 {
			return val, 0, errDecode
		}
		return protoreflect.ValueOfInt64(protowire.DecodeZigZag(v)), n, nil
	case protoreflect.Uint64Kind:
		if wtyp != protowire.VarintType {
			return val, 0, errUnknown
		}
		v, n := protowire.ConsumeVarint(b)
		if n < 0 {
			return val, 0, errDecode
		}
		return protoreflect.ValueOfUint64(v), n, nil
	case protoreflect.Sfixed32Kind:
		if wtyp != protowire.Fixed32Type {
			return val, 0, errUnknown
		}
		v, n := protowire.ConsumeFixed32(b)
		if n < 0 {
			return val, 0, errDecode
		}
		return protoreflect.ValueOfInt32(int32(v)), n, nil
	case protoreflect.Fixed32Kind:
		if wtyp != protowire.Fixed32Type {
			return val, 0, errUnknown
		}
		v, n := protowire.ConsumeFixed32(b)
		if n < 0 {
			return val, 0, errDecode
		}
		return protoreflect.ValueOfUint32(uint32(v)), n, nil
	case protoreflect.FloatKind:
		if wtyp != protowire.Fixed32Type {
			return val, 0, errUnknown
		}
		v, n := protowire.ConsumeFixed32(b)
		if n < 0 {
			return val, 0, errDecode
		}
		return protoreflect.ValueOfFloat32(math.Float32frombits(uint32(v))), n, nil
	case protoreflect.Sfixed64Kind:
		if wtyp != protowire.Fixed64Type {
			return val, 0, errUnknown
		}
		v, n := protowire.ConsumeFixed64(b)
		if n < 0 {
			return val, 0, errDecode
		}
		return protoreflect.ValueOfInt64(int64(v)), n, nil
	case protoreflect.Fixed64Kind:
		if wtyp != protowire.Fixed64Type {
			return val, 0, errUnknown
		}
		v, n := protowire.ConsumeFixed64(b)
		if n < 0 {
			return val, 0, errDecode
		}
		return protoreflect.ValueOfUint64(v), n, nil
	case protoreflect.DoubleKind:
		if wtyp != protowire.Fixed64Type {
			return val, 0, errUnknown
		}
		v, n := protowire.ConsumeFixed64(b)
		if n < 0 {
			return val, 0, errDecode
		}
		return protoreflect.ValueOfFloat64(math.Float64frombits(v)), n, nil
	case protoreflect.StringKind:
		if wtyp != protowire.BytesType {
			return val, 0, errUnknown
		}
		v, n := protowire.ConsumeBytes(b)
		if n < 0 {
			return val, 0, errDecode
		}
		if strs.EnforceUTF8(fd) && !utf8.Valid(v) {
			return protoreflect.Value{}, 0, errors.InvalidUTF8(string(fd.FullName()))
		}
		return protoreflect.ValueOfString(string(v)), n, nil
	case protoreflect.BytesKind:
		if wtyp != protowire.BytesType {
			return val, 0, errUnknown
		}
		v, n := protowire.ConsumeBytes(b)
	
    
func (o UnmarshalOptions) unmarshalScalar(b []byte, wtyp protowire.Type, fd protoreflect.FieldDescriptor) (val protoreflect.Value, n int, err error) {
	switch fd.Kind() {
	case protoreflect.BoolKind:
		if wtyp != protowire.VarintType {
			return val, 0, errUnknown
		}
		v, n := protowire.ConsumeVarint(b)
		if n < 0 {
			return val, 0, errDecode
		}
		return protoreflect.ValueOfBool(protowire.DecodeBool(v)), n, nil
	case protoreflect.EnumKind:
		if wtyp != protowire.VarintType {
			return val, 0, errUnknown
		}
		v, n := protowire.ConsumeVarint(b)
		if n < 0 {
			return val, 0, errDecode
		}
		return protoreflect.ValueOfEnum(protoreflect.EnumNumber(v)), n, nil
	case protoreflect.Int32Kind:
		if wtyp != protowire.VarintType {
			return val, 0, errUnknown
		}
		v, n := protowire.ConsumeVarint(b)
		if n < 0 {
			return val, 0, errDecode
		}
		return protoreflect.ValueOfInt32(int32(v)), n, nil
	case protoreflect.Sint32Kind:
		if wtyp != protowire.VarintType {
			return val, 0, errUnknown
		}
		v, n := protowire.ConsumeVarint(b)
		if n < 0 {
			return val, 0, errDecode
		}
		return protoreflect.ValueOfInt32(int32(protowire.DecodeZigZag(v & math.MaxUint32))), n, nil
	case protoreflect.Uint32Kind:
		if wtyp != protowire.VarintType {
			return val, 0, errUnknown
		}
		v, n := protowire.ConsumeVarint(b)
		if n < 0 {
			return val, 0, errDecode
		}
		return protoreflect.ValueOfUint32(uint32(v)), n, nil
	case protoreflect.Int64Kind:
		if wtyp != protowire.VarintType {
			return val, 0, errUnknown
		}
		v, n := protowire.ConsumeVarint(b)
		if n < 0 {
			return val, 0, errDecode
		}
		return protoreflect.ValueOfInt64(int64(v)), n, nil
	case protoreflect.Sint64Kind:
		if wtyp != protowire.VarintType {
			return val, 0, errUnknown
		}
		v, n := protowire.ConsumeVarint(b)
		if n < 0 {
			return val, 0, errDecode
		}
		return protoreflect.ValueOfInt64(protowire.DecodeZigZag(v)), n, nil
	case protoreflect.Uint64Kind:
		if wtyp != protowire.VarintType {
			return val, 0, errUnknown
		}
		v, n := protowire.ConsumeVarint(b)
		if n < 0 {
			return val, 0, errDecode
		}
		return protoreflect.ValueOfUint64(v), n, nil
	case protoreflect.Sfixed32Kind:
		if wtyp != protowire.Fixed32Type {
			return val, 0, errUnknown
		}
		v, n := protowire.ConsumeFixed32(b)
		if n < 0 {
			return val, 0, errDecode
		}
		return protoreflect.ValueOfInt32(int32(v)), n, nil
	case protoreflect.Fixed32Kind:
		if wtyp != protowire.Fixed32Type {
			return val, 0, errUnknown
		}
		v, n := protowire.ConsumeFixed32(b)
		if n < 0 {
			return val, 0, errDecode
		}
		return protoreflect.ValueOfUint32(uint32(v)), n, nil
	case protoreflect.FloatKind:
		if wtyp != protowire.Fixed32Type {
			return val, 0, errUnknown
		}
		v, n := protowire.ConsumeFixed32(b)
		if n < 0 {
			return val, 0, errDecode
		}
		return protoreflect.ValueOfFloat32(math.Float32frombits(uint32(v))), n, nil
	case protoreflect.Sfixed64Kind:
		if wtyp != protowire.Fixed64Type {
			return val, 0, errUnknown
		}
		v, n := protowire.ConsumeFixed64(b)
		if n < 0 {
			return val, 0, errDecode
		}
		return protoreflect.ValueOfInt64(int64(v)), n, nil
	case protoreflect.Fixed64Kind:
		if wtyp != protowire.Fixed64Type {
			return val, 0, errUnknown
		}
		v, n := protowire.ConsumeFixed64(b)
		if n < 0 {
			return val, 0, errDecode
		}
		return protoreflect.ValueOfUint64(v), n, nil
	case protoreflect.DoubleKind:
		if wtyp != protowire.Fixed64Type {
			return val, 0, errUnknown
		}
		v, n := protowire.ConsumeFixed64(b)
		if n < 0 {
			return val, 0, errDecode
		}
		return protoreflect.ValueOfFloat64(math.Float64frombits(v)), n, nil
	case protoreflect.StringKind:
		if wtyp != protowire.BytesType {
			return val, 0, errUnknown
		}
		v, n := protowire.ConsumeBytes(b)
		if n < 0 {
			return val, 0, errDecode
		}
		if strs.EnforceUTF8(fd) && !utf8.Valid(v) {
			return protoreflect.Value{}, 0, errors.InvalidUTF8(string(fd.FullName()))
		}
		return protoreflect.ValueOfString(string(v)), n, nil
	case protoreflect.BytesKind:
		if wtyp != protowire.BytesType {
			return val, 0, errUnknown
		}
		v, n := protowire.ConsumeBytes(b)
		if n < 0 {
			return val, 0, errDecode
		}
		return protoreflect.ValueOfBytes(append(emptyBuf[:], v...)), n, nil
	case protoreflect.MessageKind:
		if wtyp != protowire.BytesType {
			return val, 0, errUnknown
		}
		v, n := protowire.ConsumeBytes(b)
		if n < 0 {
			return val, 0, errDecode
		}
		return protoreflect.ValueOfBytes(v), n, nil
	case protoreflect.GroupKind:
		if wtyp != protowire.StartGroupType {
			return val, 0, errUnknown
		}
		v, n := protowire.ConsumeGroup(fd.Number(), b)
		if n < 0 {
			return val, 0, errDecode
		}
		return protoreflect.ValueOfBytes(v), n, nil
	default:
		return val, 0, errUnknown
	}
}