methods.go 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. Depth int
  54. }
  55. unmarshalOutput = struct {
  56. pragma.NoUnkeyedLiterals
  57. Flags uint8
  58. }
  59. mergeInput = struct {
  60. pragma.NoUnkeyedLiterals
  61. Source Message
  62. Destination Message
  63. }
  64. mergeOutput = struct {
  65. pragma.NoUnkeyedLiterals
  66. Flags uint8
  67. }
  68. checkInitializedInput = struct {
  69. pragma.NoUnkeyedLiterals
  70. Message Message
  71. }
  72. checkInitializedOutput = struct {
  73. pragma.NoUnkeyedLiterals
  74. }
  75. )