xref: /aosp_15_r20/external/golang-protobuf/reflect/protoreflect/methods.go (revision 1c12ee1efe575feb122dbf939ff15148a3b3e8f2)
1// Copyright 2020 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 protoreflect
6
7import (
8	"google.golang.org/protobuf/internal/pragma"
9)
10
11// The following types are used by the fast-path Message.ProtoMethods method.
12//
13// To avoid polluting the public protoreflect API with types used only by
14// low-level implementations, the canonical definitions of these types are
15// in the runtime/protoiface package. The definitions here and in protoiface
16// must be kept in sync.
17type (
18	methods = struct {
19		pragma.NoUnkeyedLiterals
20		Flags            supportFlags
21		Size             func(sizeInput) sizeOutput
22		Marshal          func(marshalInput) (marshalOutput, error)
23		Unmarshal        func(unmarshalInput) (unmarshalOutput, error)
24		Merge            func(mergeInput) mergeOutput
25		CheckInitialized func(checkInitializedInput) (checkInitializedOutput, error)
26	}
27	supportFlags = uint64
28	sizeInput    = struct {
29		pragma.NoUnkeyedLiterals
30		Message Message
31		Flags   uint8
32	}
33	sizeOutput = struct {
34		pragma.NoUnkeyedLiterals
35		Size int
36	}
37	marshalInput = struct {
38		pragma.NoUnkeyedLiterals
39		Message Message
40		Buf     []byte
41		Flags   uint8
42	}
43	marshalOutput = struct {
44		pragma.NoUnkeyedLiterals
45		Buf []byte
46	}
47	unmarshalInput = struct {
48		pragma.NoUnkeyedLiterals
49		Message  Message
50		Buf      []byte
51		Flags    uint8
52		Resolver interface {
53			FindExtensionByName(field FullName) (ExtensionType, error)
54			FindExtensionByNumber(message FullName, field FieldNumber) (ExtensionType, error)
55		}
56		Depth int
57	}
58	unmarshalOutput = struct {
59		pragma.NoUnkeyedLiterals
60		Flags uint8
61	}
62	mergeInput = struct {
63		pragma.NoUnkeyedLiterals
64		Source      Message
65		Destination Message
66	}
67	mergeOutput = struct {
68		pragma.NoUnkeyedLiterals
69		Flags uint8
70	}
71	checkInitializedInput = struct {
72		pragma.NoUnkeyedLiterals
73		Message Message
74	}
75	checkInitializedOutput = struct {
76		pragma.NoUnkeyedLiterals
77	}
78)
79