source: code/trunk/vendor/google.golang.org/protobuf/internal/impl/enum.go@ 822

Last change on this file since 822 was 822, checked in by yakumo.izuru, 22 months ago

Prefer immortal.run over runit and rc.d, use vendored modules
for convenience.

Signed-off-by: Izuru Yakumo <yakumo.izuru@…>

File size: 594 bytes
Line 
1// Copyright 2019 The Go Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5package impl
6
7import (
8 "reflect"
9
10 "google.golang.org/protobuf/reflect/protoreflect"
11)
12
13type EnumInfo struct {
14 GoReflectType reflect.Type // int32 kind
15 Desc protoreflect.EnumDescriptor
16}
17
18func (t *EnumInfo) New(n protoreflect.EnumNumber) protoreflect.Enum {
19 return reflect.ValueOf(n).Convert(t.GoReflectType).Interface().(protoreflect.Enum)
20}
21func (t *EnumInfo) Descriptor() protoreflect.EnumDescriptor { return t.Desc }
Note: See TracBrowser for help on using the repository browser.