grpc_testing_payloads.pb.swift 11 KB

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