Herbie Ong | cddf819 | 2018-11-28 18:25:20 -0800 | [diff] [blame] | 1 | // Copyright 2018 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 | |
| 5 | package proto |
| 6 | |
Damien Neil | 0d3e8cc | 2019-04-01 13:31:55 -0700 | [diff] [blame^] | 7 | import ( |
| 8 | "errors" |
| 9 | |
| 10 | "github.com/golang/protobuf/v2/reflect/protoreflect" |
| 11 | "github.com/golang/protobuf/v2/runtime/protoiface" |
| 12 | ) |
Herbie Ong | cddf819 | 2018-11-28 18:25:20 -0800 | [diff] [blame] | 13 | |
| 14 | // Message is the top-level interface that all messages must implement. |
| 15 | type Message = protoreflect.ProtoMessage |
Damien Neil | 0d3e8cc | 2019-04-01 13:31:55 -0700 | [diff] [blame^] | 16 | |
| 17 | // errInternalNoFast indicates that fast-path operations are not available for a message. |
| 18 | var errInternalNoFast = errors.New("proto: BUG: internal error (errInternalNoFast)") |
| 19 | |
| 20 | func protoMethods(m Message) *protoiface.Methods { |
| 21 | if x, ok := m.(protoiface.Methoder); ok { |
| 22 | return x.XXX_Methods() |
| 23 | } |
| 24 | return nil |
| 25 | } |