// DO NOT EDIT. // swift-format-ignore-file // // Generated by the Swift generator plugin for the protocol buffer compiler. // Source: grpc/testing/payloads.proto // // For information on using the generated types, please see the documentation: // https://github.com/apple/swift-protobuf/ // Copyright 2015 gRPC authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. import Foundation import SwiftProtobuf // If the compiler emits an error on this type, it is because this file // was generated by a version of the `protoc` Swift plug-in that is // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } struct Grpc_Testing_ByteBufferParams { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. var reqSize: Int32 = 0 var respSize: Int32 = 0 var unknownFields = SwiftProtobuf.UnknownStorage() init() {} } struct Grpc_Testing_SimpleProtoParams { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. var reqSize: Int32 = 0 var respSize: Int32 = 0 var unknownFields = SwiftProtobuf.UnknownStorage() init() {} } /// TODO (vpai): Fill this in once the details of complex, representative /// protos are decided struct Grpc_Testing_ComplexProtoParams { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. var unknownFields = SwiftProtobuf.UnknownStorage() init() {} } struct Grpc_Testing_PayloadConfig { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. var payload: Grpc_Testing_PayloadConfig.OneOf_Payload? = nil var bytebufParams: Grpc_Testing_ByteBufferParams { get { if case .bytebufParams(let v)? = payload {return v} return Grpc_Testing_ByteBufferParams() } set {payload = .bytebufParams(newValue)} } var simpleParams: Grpc_Testing_SimpleProtoParams { get { if case .simpleParams(let v)? = payload {return v} return Grpc_Testing_SimpleProtoParams() } set {payload = .simpleParams(newValue)} } var complexParams: Grpc_Testing_ComplexProtoParams { get { if case .complexParams(let v)? = payload {return v} return Grpc_Testing_ComplexProtoParams() } set {payload = .complexParams(newValue)} } var unknownFields = SwiftProtobuf.UnknownStorage() enum OneOf_Payload: Equatable { case bytebufParams(Grpc_Testing_ByteBufferParams) case simpleParams(Grpc_Testing_SimpleProtoParams) case complexParams(Grpc_Testing_ComplexProtoParams) #if !swift(>=4.1) static func ==(lhs: Grpc_Testing_PayloadConfig.OneOf_Payload, rhs: Grpc_Testing_PayloadConfig.OneOf_Payload) -> Bool { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch (lhs, rhs) { case (.bytebufParams, .bytebufParams): return { guard case .bytebufParams(let l) = lhs, case .bytebufParams(let r) = rhs else { preconditionFailure() } return l == r }() case (.simpleParams, .simpleParams): return { guard case .simpleParams(let l) = lhs, case .simpleParams(let r) = rhs else { preconditionFailure() } return l == r }() case (.complexParams, .complexParams): return { guard case .complexParams(let l) = lhs, case .complexParams(let r) = rhs else { preconditionFailure() } return l == r }() default: return false } } #endif } init() {} } #if swift(>=5.5) && canImport(_Concurrency) extension Grpc_Testing_ByteBufferParams: @unchecked Sendable {} extension Grpc_Testing_SimpleProtoParams: @unchecked Sendable {} extension Grpc_Testing_ComplexProtoParams: @unchecked Sendable {} extension Grpc_Testing_PayloadConfig: @unchecked Sendable {} extension Grpc_Testing_PayloadConfig.OneOf_Payload: @unchecked Sendable {} #endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "grpc.testing" extension Grpc_Testing_ByteBufferParams: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".ByteBufferParams" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "req_size"), 2: .standard(proto: "resp_size"), ] mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { case 1: try { try decoder.decodeSingularInt32Field(value: &self.reqSize) }() case 2: try { try decoder.decodeSingularInt32Field(value: &self.respSize) }() default: break } } } func traverse(visitor: inout V) throws { if self.reqSize != 0 { try visitor.visitSingularInt32Field(value: self.reqSize, fieldNumber: 1) } if self.respSize != 0 { try visitor.visitSingularInt32Field(value: self.respSize, fieldNumber: 2) } try unknownFields.traverse(visitor: &visitor) } static func ==(lhs: Grpc_Testing_ByteBufferParams, rhs: Grpc_Testing_ByteBufferParams) -> Bool { if lhs.reqSize != rhs.reqSize {return false} if lhs.respSize != rhs.respSize {return false} if lhs.unknownFields != rhs.unknownFields {return false} return true } } extension Grpc_Testing_SimpleProtoParams: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".SimpleProtoParams" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "req_size"), 2: .standard(proto: "resp_size"), ] mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { case 1: try { try decoder.decodeSingularInt32Field(value: &self.reqSize) }() case 2: try { try decoder.decodeSingularInt32Field(value: &self.respSize) }() default: break } } } func traverse(visitor: inout V) throws { if self.reqSize != 0 { try visitor.visitSingularInt32Field(value: self.reqSize, fieldNumber: 1) } if self.respSize != 0 { try visitor.visitSingularInt32Field(value: self.respSize, fieldNumber: 2) } try unknownFields.traverse(visitor: &visitor) } static func ==(lhs: Grpc_Testing_SimpleProtoParams, rhs: Grpc_Testing_SimpleProtoParams) -> Bool { if lhs.reqSize != rhs.reqSize {return false} if lhs.respSize != rhs.respSize {return false} if lhs.unknownFields != rhs.unknownFields {return false} return true } } extension Grpc_Testing_ComplexProtoParams: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".ComplexProtoParams" static let _protobuf_nameMap = SwiftProtobuf._NameMap() mutating func decodeMessage(decoder: inout D) throws { while let _ = try decoder.nextFieldNumber() { } } func traverse(visitor: inout V) throws { try unknownFields.traverse(visitor: &visitor) } static func ==(lhs: Grpc_Testing_ComplexProtoParams, rhs: Grpc_Testing_ComplexProtoParams) -> Bool { if lhs.unknownFields != rhs.unknownFields {return false} return true } } extension Grpc_Testing_PayloadConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".PayloadConfig" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "bytebuf_params"), 2: .standard(proto: "simple_params"), 3: .standard(proto: "complex_params"), ] mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { case 1: try { var v: Grpc_Testing_ByteBufferParams? var hadOneofValue = false if let current = self.payload { hadOneofValue = true if case .bytebufParams(let m) = current {v = m} } try decoder.decodeSingularMessageField(value: &v) if let v = v { if hadOneofValue {try decoder.handleConflictingOneOf()} self.payload = .bytebufParams(v) } }() case 2: try { var v: Grpc_Testing_SimpleProtoParams? var hadOneofValue = false if let current = self.payload { hadOneofValue = true if case .simpleParams(let m) = current {v = m} } try decoder.decodeSingularMessageField(value: &v) if let v = v { if hadOneofValue {try decoder.handleConflictingOneOf()} self.payload = .simpleParams(v) } }() case 3: try { var v: Grpc_Testing_ComplexProtoParams? var hadOneofValue = false if let current = self.payload { hadOneofValue = true if case .complexParams(let m) = current {v = m} } try decoder.decodeSingularMessageField(value: &v) if let v = v { if hadOneofValue {try decoder.handleConflictingOneOf()} self.payload = .complexParams(v) } }() default: break } } } func traverse(visitor: inout V) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and // https://github.com/apple/swift-protobuf/issues/1182 switch self.payload { case .bytebufParams?: try { guard case .bytebufParams(let v)? = self.payload else { preconditionFailure() } try visitor.visitSingularMessageField(value: v, fieldNumber: 1) }() case .simpleParams?: try { guard case .simpleParams(let v)? = self.payload else { preconditionFailure() } try visitor.visitSingularMessageField(value: v, fieldNumber: 2) }() case .complexParams?: try { guard case .complexParams(let v)? = self.payload else { preconditionFailure() } try visitor.visitSingularMessageField(value: v, fieldNumber: 3) }() case nil: break } try unknownFields.traverse(visitor: &visitor) } static func ==(lhs: Grpc_Testing_PayloadConfig, rhs: Grpc_Testing_PayloadConfig) -> Bool { if lhs.payload != rhs.payload {return false} if lhs.unknownFields != rhs.unknownFields {return false} return true } }