methods.go 2.1 KB

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