2
0

grpc_testing_payloads.pb.swift 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  1. // DO NOT EDIT.
  2. // swift-format-ignore-file
  3. //
  4. // Generated by the Swift generator plugin for the protocol buffer compiler.
  5. // Source: grpc/testing/payloads.proto
  6. //
  7. // For information on using the generated types, please see the documentation:
  8. // https://github.com/apple/swift-protobuf/
  9. // Copyright 2015 gRPC authors.
  10. //
  11. // Licensed under the Apache License, Version 2.0 (the "License");
  12. // you may not use this file except in compliance with the License.
  13. // You may obtain a copy of the License at
  14. //
  15. // http://www.apache.org/licenses/LICENSE-2.0
  16. //
  17. // Unless required by applicable law or agreed to in writing, software
  18. // distributed under the License is distributed on an "AS IS" BASIS,
  19. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  20. // See the License for the specific language governing permissions and
  21. // limitations under the License.
  22. import Foundation
  23. import SwiftProtobuf
  24. // If the compiler emits an error on this type, it is because this file
  25. // was generated by a version of the `protoc` Swift plug-in that is
  26. // incompatible with the version of SwiftProtobuf to which you are linking.
  27. // Please ensure that you are building against the same version of the API
  28. // that was used to generate this file.
  29. fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
  30. struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
  31. typealias Version = _2
  32. }
  33. struct Grpc_Testing_ByteBufferParams: Sendable {
  34. // SwiftProtobuf.Message conformance is added in an extension below. See the
  35. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  36. // methods supported on all messages.
  37. var reqSize: Int32 = 0
  38. var respSize: Int32 = 0
  39. var unknownFields = SwiftProtobuf.UnknownStorage()
  40. init() {}
  41. }
  42. struct Grpc_Testing_SimpleProtoParams: Sendable {
  43. // SwiftProtobuf.Message conformance is added in an extension below. See the
  44. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  45. // methods supported on all messages.
  46. var reqSize: Int32 = 0
  47. var respSize: Int32 = 0
  48. var unknownFields = SwiftProtobuf.UnknownStorage()
  49. init() {}
  50. }
  51. /// TODO (vpai): Fill this in once the details of complex, representative
  52. /// protos are decided
  53. struct Grpc_Testing_ComplexProtoParams: Sendable {
  54. // SwiftProtobuf.Message conformance is added in an extension below. See the
  55. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  56. // methods supported on all messages.
  57. var unknownFields = SwiftProtobuf.UnknownStorage()
  58. init() {}
  59. }
  60. struct Grpc_Testing_PayloadConfig: Sendable {
  61. // SwiftProtobuf.Message conformance is added in an extension below. See the
  62. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  63. // methods supported on all messages.
  64. var payload: Grpc_Testing_PayloadConfig.OneOf_Payload? = nil
  65. var bytebufParams: Grpc_Testing_ByteBufferParams {
  66. get {
  67. if case .bytebufParams(let v)? = payload {return v}
  68. return Grpc_Testing_ByteBufferParams()
  69. }
  70. set {payload = .bytebufParams(newValue)}
  71. }
  72. var simpleParams: Grpc_Testing_SimpleProtoParams {
  73. get {
  74. if case .simpleParams(let v)? = payload {return v}
  75. return Grpc_Testing_SimpleProtoParams()
  76. }
  77. set {payload = .simpleParams(newValue)}
  78. }
  79. var complexParams: Grpc_Testing_ComplexProtoParams {
  80. get {
  81. if case .complexParams(let v)? = payload {return v}
  82. return Grpc_Testing_ComplexProtoParams()
  83. }
  84. set {payload = .complexParams(newValue)}
  85. }
  86. var unknownFields = SwiftProtobuf.UnknownStorage()
  87. enum OneOf_Payload: Equatable, Sendable {
  88. case bytebufParams(Grpc_Testing_ByteBufferParams)
  89. case simpleParams(Grpc_Testing_SimpleProtoParams)
  90. case complexParams(Grpc_Testing_ComplexProtoParams)
  91. }
  92. init() {}
  93. }
  94. // MARK: - Code below here is support for the SwiftProtobuf runtime.
  95. fileprivate let _protobuf_package = "grpc.testing"
  96. extension Grpc_Testing_ByteBufferParams: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  97. static let protoMessageName: String = _protobuf_package + ".ByteBufferParams"
  98. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  99. 1: .standard(proto: "req_size"),
  100. 2: .standard(proto: "resp_size"),
  101. ]
  102. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  103. while let fieldNumber = try decoder.nextFieldNumber() {
  104. // The use of inline closures is to circumvent an issue where the compiler
  105. // allocates stack space for every case branch when no optimizations are
  106. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  107. switch fieldNumber {
  108. case 1: try { try decoder.decodeSingularInt32Field(value: &self.reqSize) }()
  109. case 2: try { try decoder.decodeSingularInt32Field(value: &self.respSize) }()
  110. default: break
  111. }
  112. }
  113. }
  114. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  115. if self.reqSize != 0 {
  116. try visitor.visitSingularInt32Field(value: self.reqSize, fieldNumber: 1)
  117. }
  118. if self.respSize != 0 {
  119. try visitor.visitSingularInt32Field(value: self.respSize, fieldNumber: 2)
  120. }
  121. try unknownFields.traverse(visitor: &visitor)
  122. }
  123. static func ==(lhs: Grpc_Testing_ByteBufferParams, rhs: Grpc_Testing_ByteBufferParams) -> Bool {
  124. if lhs.reqSize != rhs.reqSize {return false}
  125. if lhs.respSize != rhs.respSize {return false}
  126. if lhs.unknownFields != rhs.unknownFields {return false}
  127. return true
  128. }
  129. }
  130. extension Grpc_Testing_SimpleProtoParams: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  131. static let protoMessageName: String = _protobuf_package + ".SimpleProtoParams"
  132. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  133. 1: .standard(proto: "req_size"),
  134. 2: .standard(proto: "resp_size"),
  135. ]
  136. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  137. while let fieldNumber = try decoder.nextFieldNumber() {
  138. // The use of inline closures is to circumvent an issue where the compiler
  139. // allocates stack space for every case branch when no optimizations are
  140. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  141. switch fieldNumber {
  142. case 1: try { try decoder.decodeSingularInt32Field(value: &self.reqSize) }()
  143. case 2: try { try decoder.decodeSingularInt32Field(value: &self.respSize) }()
  144. default: break
  145. }
  146. }
  147. }
  148. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  149. if self.reqSize != 0 {
  150. try visitor.visitSingularInt32Field(value: self.reqSize, fieldNumber: 1)
  151. }
  152. if self.respSize != 0 {
  153. try visitor.visitSingularInt32Field(value: self.respSize, fieldNumber: 2)
  154. }
  155. try unknownFields.traverse(visitor: &visitor)
  156. }
  157. static func ==(lhs: Grpc_Testing_SimpleProtoParams, rhs: Grpc_Testing_SimpleProtoParams) -> Bool {
  158. if lhs.reqSize != rhs.reqSize {return false}
  159. if lhs.respSize != rhs.respSize {return false}
  160. if lhs.unknownFields != rhs.unknownFields {return false}
  161. return true
  162. }
  163. }
  164. extension Grpc_Testing_ComplexProtoParams: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  165. static let protoMessageName: String = _protobuf_package + ".ComplexProtoParams"
  166. static let _protobuf_nameMap = SwiftProtobuf._NameMap()
  167. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  168. // Load everything into unknown fields
  169. while try decoder.nextFieldNumber() != nil {}
  170. }
  171. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  172. try unknownFields.traverse(visitor: &visitor)
  173. }
  174. static func ==(lhs: Grpc_Testing_ComplexProtoParams, rhs: Grpc_Testing_ComplexProtoParams) -> Bool {
  175. if lhs.unknownFields != rhs.unknownFields {return false}
  176. return true
  177. }
  178. }
  179. extension Grpc_Testing_PayloadConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  180. static let protoMessageName: String = _protobuf_package + ".PayloadConfig"
  181. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  182. 1: .standard(proto: "bytebuf_params"),
  183. 2: .standard(proto: "simple_params"),
  184. 3: .standard(proto: "complex_params"),
  185. ]
  186. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  187. while let fieldNumber = try decoder.nextFieldNumber() {
  188. // The use of inline closures is to circumvent an issue where the compiler
  189. // allocates stack space for every case branch when no optimizations are
  190. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  191. switch fieldNumber {
  192. case 1: try {
  193. var v: Grpc_Testing_ByteBufferParams?
  194. var hadOneofValue = false
  195. if let current = self.payload {
  196. hadOneofValue = true
  197. if case .bytebufParams(let m) = current {v = m}
  198. }
  199. try decoder.decodeSingularMessageField(value: &v)
  200. if let v = v {
  201. if hadOneofValue {try decoder.handleConflictingOneOf()}
  202. self.payload = .bytebufParams(v)
  203. }
  204. }()
  205. case 2: try {
  206. var v: Grpc_Testing_SimpleProtoParams?
  207. var hadOneofValue = false
  208. if let current = self.payload {
  209. hadOneofValue = true
  210. if case .simpleParams(let m) = current {v = m}
  211. }
  212. try decoder.decodeSingularMessageField(value: &v)
  213. if let v = v {
  214. if hadOneofValue {try decoder.handleConflictingOneOf()}
  215. self.payload = .simpleParams(v)
  216. }
  217. }()
  218. case 3: try {
  219. var v: Grpc_Testing_ComplexProtoParams?
  220. var hadOneofValue = false
  221. if let current = self.payload {
  222. hadOneofValue = true
  223. if case .complexParams(let m) = current {v = m}
  224. }
  225. try decoder.decodeSingularMessageField(value: &v)
  226. if let v = v {
  227. if hadOneofValue {try decoder.handleConflictingOneOf()}
  228. self.payload = .complexParams(v)
  229. }
  230. }()
  231. default: break
  232. }
  233. }
  234. }
  235. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  236. // The use of inline closures is to circumvent an issue where the compiler
  237. // allocates stack space for every if/case branch local when no optimizations
  238. // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
  239. // https://github.com/apple/swift-protobuf/issues/1182
  240. switch self.payload {
  241. case .bytebufParams?: try {
  242. guard case .bytebufParams(let v)? = self.payload else { preconditionFailure() }
  243. try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
  244. }()
  245. case .simpleParams?: try {
  246. guard case .simpleParams(let v)? = self.payload else { preconditionFailure() }
  247. try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
  248. }()
  249. case .complexParams?: try {
  250. guard case .complexParams(let v)? = self.payload else { preconditionFailure() }
  251. try visitor.visitSingularMessageField(value: v, fieldNumber: 3)
  252. }()
  253. case nil: break
  254. }
  255. try unknownFields.traverse(visitor: &visitor)
  256. }
  257. static func ==(lhs: Grpc_Testing_PayloadConfig, rhs: Grpc_Testing_PayloadConfig) -> Bool {
  258. if lhs.payload != rhs.payload {return false}
  259. if lhs.unknownFields != rhs.unknownFields {return false}
  260. return true
  261. }
  262. }