methods.go 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. }
  24. supportFlags = uint64
  25. sizeInput = struct {
  26. pragma.NoUnkeyedLiterals
  27. Message Message
  28. Flags uint8
  29. }
  30. sizeOutput = struct {
  31. pragma.NoUnkeyedLiterals
  32. Size int
  33. }
  34. marshalInput = struct {
  35. pragma.NoUnkeyedLiterals
  36. Message Message
  37. Buf []byte
  38. Flags uint8
  39. }
  40. marshalOutput = struct {
  41. pragma.NoUnkeyedLiterals
  42. Buf []byte
  43. }
  44. unmarshalInput = struct {
  45. pragma.NoUnkeyedLiterals
  46. Message Message
  47. Buf []byte
  48. Flags uint8
  49. Resolver interface {
  50. FindExtensionByName(field FullName) (ExtensionType, error)
  51. FindExtensionByNumber(message FullName, field FieldNumber) (ExtensionType, error)
  52. }
  53. }
  54. unmarshalOutput = struct {
  55. pragma.NoUnkeyedLiterals
  56. Flags uint8
  57. }
  58. mergeInput = struct {
  59. pragma.NoUnkeyedLiterals
  60. Source Message
  61. Destination Message
  62. }
  63. mergeOutput = struct {
  64. pragma.NoUnkeyedLiterals
  65. Flags uint8
  66. }
  67. checkInitializedInput = struct {
  68. pragma.NoUnkeyedLiterals
  69. Message Message
  70. }
  71. checkInitializedOutput = struct {
  72. pragma.NoUnkeyedLiterals
  73. }
  74. )