grpc_testing_payloads.pb.swift 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  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 {
  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 {
  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 {
  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 {
  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 {
  88. case bytebufParams(Grpc_Testing_ByteBufferParams)
  89. case simpleParams(Grpc_Testing_SimpleProtoParams)
  90. case complexParams(Grpc_Testing_ComplexProtoParams)
  91. #if !swift(>=4.1)
  92. static func ==(lhs: Grpc_Testing_PayloadConfig.OneOf_Payload, rhs: Grpc_Testing_PayloadConfig.OneOf_Payload) -> Bool {
  93. // The use of inline closures is to circumvent an issue where the compiler
  94. // allocates stack space for every case branch when no optimizations are
  95. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  96. switch (lhs, rhs) {
  97. case (.bytebufParams, .bytebufParams): return {
  98. guard case .bytebufParams(let l) = lhs, case .bytebufParams(let r) = rhs else { preconditionFailure() }
  99. return l == r
  100. }()
  101. case (.simpleParams, .simpleParams): return {
  102. guard case .simpleParams(let l) = lhs, case .simpleParams(let r) = rhs else { preconditionFailure() }
  103. return l == r
  104. }()
  105. case (.complexParams, .complexParams): return {
  106. guard case .complexParams(let l) = lhs, case .complexParams(let r) = rhs else { preconditionFailure() }
  107. return l == r
  108. }()
  109. default: return false
  110. }
  111. }
  112. #endif
  113. }
  114. init() {}
  115. }
  116. #if swift(>=5.5) && canImport(_Concurrency)
  117. extension Grpc_Testing_ByteBufferParams: @unchecked Sendable {}
  118. extension Grpc_Testing_SimpleProtoParams: @unchecked Sendable {}
  119. extension Grpc_Testing_ComplexProtoParams: @unchecked Sendable {}
  120. extension Grpc_Testing_PayloadConfig: @unchecked Sendable {}
  121. extension Grpc_Testing_PayloadConfig.OneOf_Payload: @unchecked Sendable {}
  122. #endif // swift(>=5.5) && canImport(_Concurrency)
  123. // MARK: - Code below here is support for the SwiftProtobuf runtime.
  124. fileprivate let _protobuf_package = "grpc.testing"
  125. extension Grpc_Testing_ByteBufferParams: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  126. static let protoMessageName: String = _protobuf_package + ".ByteBufferParams"
  127. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  128. 1: .standard(proto: "req_size"),
  129. 2: .standard(proto: "resp_size"),
  130. ]
  131. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  132. while let fieldNumber = try decoder.nextFieldNumber() {
  133. // The use of inline closures is to circumvent an issue where the compiler
  134. // allocates stack space for every case branch when no optimizations are
  135. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  136. switch fieldNumber {
  137. case 1: try { try decoder.decodeSingularInt32Field(value: &self.reqSize) }()
  138. case 2: try { try decoder.decodeSingularInt32Field(value: &self.respSize) }()
  139. default: break
  140. }
  141. }
  142. }
  143. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  144. if self.reqSize != 0 {
  145. try visitor.visitSingularInt32Field(value: self.reqSize, fieldNumber: 1)
  146. }
  147. if self.respSize != 0 {
  148. try visitor.visitSingularInt32Field(value: self.respSize, fieldNumber: 2)
  149. }
  150. try unknownFields.traverse(visitor: &visitor)
  151. }
  152. static func ==(lhs: Grpc_Testing_ByteBufferParams, rhs: Grpc_Testing_ByteBufferParams) -> Bool {
  153. if lhs.reqSize != rhs.reqSize {return false}
  154. if lhs.respSize != rhs.respSize {return false}
  155. if lhs.unknownFields != rhs.unknownFields {return false}
  156. return true
  157. }
  158. }
  159. extension Grpc_Testing_SimpleProtoParams: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  160. static let protoMessageName: String = _protobuf_package + ".SimpleProtoParams"
  161. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  162. 1: .standard(proto: "req_size"),
  163. 2: .standard(proto: "resp_size"),
  164. ]
  165. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  166. while let fieldNumber = try decoder.nextFieldNumber() {
  167. // The use of inline closures is to circumvent an issue where the compiler
  168. // allocates stack space for every case branch when no optimizations are
  169. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  170. switch fieldNumber {
  171. case 1: try { try decoder.decodeSingularInt32Field(value: &self.reqSize) }()
  172. case 2: try { try decoder.decodeSingularInt32Field(value: &self.respSize) }()
  173. default: break
  174. }
  175. }
  176. }
  177. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  178. if self.reqSize != 0 {
  179. try visitor.visitSingularInt32Field(value: self.reqSize, fieldNumber: 1)
  180. }
  181. if self.respSize != 0 {
  182. try visitor.visitSingularInt32Field(value: self.respSize, fieldNumber: 2)
  183. }
  184. try unknownFields.traverse(visitor: &visitor)
  185. }
  186. static func ==(lhs: Grpc_Testing_SimpleProtoParams, rhs: Grpc_Testing_SimpleProtoParams) -> Bool {
  187. if lhs.reqSize != rhs.reqSize {return false}
  188. if lhs.respSize != rhs.respSize {return false}
  189. if lhs.unknownFields != rhs.unknownFields {return false}
  190. return true
  191. }
  192. }
  193. extension Grpc_Testing_ComplexProtoParams: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  194. static let protoMessageName: String = _protobuf_package + ".ComplexProtoParams"
  195. static let _protobuf_nameMap = SwiftProtobuf._NameMap()
  196. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  197. while let _ = try decoder.nextFieldNumber() {
  198. }
  199. }
  200. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  201. try unknownFields.traverse(visitor: &visitor)
  202. }
  203. static func ==(lhs: Grpc_Testing_ComplexProtoParams, rhs: Grpc_Testing_ComplexProtoParams) -> Bool {
  204. if lhs.unknownFields != rhs.unknownFields {return false}
  205. return true
  206. }
  207. }
  208. extension Grpc_Testing_PayloadConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  209. static let protoMessageName: String = _protobuf_package + ".PayloadConfig"
  210. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  211. 1: .standard(proto: "bytebuf_params"),
  212. 2: .standard(proto: "simple_params"),
  213. 3: .standard(proto: "complex_params"),
  214. ]
  215. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  216. while let fieldNumber = try decoder.nextFieldNumber() {
  217. // The use of inline closures is to circumvent an issue where the compiler
  218. // allocates stack space for every case branch when no optimizations are
  219. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  220. switch fieldNumber {
  221. case 1: try {
  222. var v: Grpc_Testing_ByteBufferParams?
  223. var hadOneofValue = false
  224. if let current = self.payload {
  225. hadOneofValue = true
  226. if case .bytebufParams(let m) = current {v = m}
  227. }
  228. try decoder.decodeSingularMessageField(value: &v)
  229. if let v = v {
  230. if hadOneofValue {try decoder.handleConflictingOneOf()}
  231. self.payload = .bytebufParams(v)
  232. }
  233. }()
  234. case 2: try {
  235. var v: Grpc_Testing_SimpleProtoParams?
  236. var hadOneofValue = false
  237. if let current = self.payload {
  238. hadOneofValue = true
  239. if case .simpleParams(let m) = current {v = m}
  240. }
  241. try decoder.decodeSingularMessageField(value: &v)
  242. if let v = v {
  243. if hadOneofValue {try decoder.handleConflictingOneOf()}
  244. self.payload = .simpleParams(v)
  245. }
  246. }()
  247. case 3: try {
  248. var v: Grpc_Testing_ComplexProtoParams?
  249. var hadOneofValue = false
  250. if let current = self.payload {
  251. hadOneofValue = true
  252. if case .complexParams(let m) = current {v = m}
  253. }
  254. try decoder.decodeSingularMessageField(value: &v)
  255. if let v = v {
  256. if hadOneofValue {try decoder.handleConflictingOneOf()}
  257. self.payload = .complexParams(v)
  258. }
  259. }()
  260. default: break
  261. }
  262. }
  263. }
  264. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  265. // The use of inline closures is to circumvent an issue where the compiler
  266. // allocates stack space for every if/case branch local when no optimizations
  267. // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
  268. // https://github.com/apple/swift-protobuf/issues/1182
  269. switch self.payload {
  270. case .bytebufParams?: try {
  271. guard case .bytebufParams(let v)? = self.payload else { preconditionFailure() }
  272. try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
  273. }()
  274. case .simpleParams?: try {
  275. guard case .simpleParams(let v)? = self.payload else { preconditionFailure() }
  276. try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
  277. }()
  278. case .complexParams?: try {
  279. guard case .complexParams(let v)? = self.payload else { preconditionFailure() }
  280. try visitor.visitSingularMessageField(value: v, fieldNumber: 3)
  281. }()
  282. case nil: break
  283. }
  284. try unknownFields.traverse(visitor: &visitor)
  285. }
  286. static func ==(lhs: Grpc_Testing_PayloadConfig, rhs: Grpc_Testing_PayloadConfig) -> Bool {
  287. if lhs.payload != rhs.payload {return false}
  288. if lhs.unknownFields != rhs.unknownFields {return false}
  289. return true
  290. }
  291. }