| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335 |
- // 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<D: SwiftProtobuf.Decoder>(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<V: SwiftProtobuf.Visitor>(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<D: SwiftProtobuf.Decoder>(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<V: SwiftProtobuf.Visitor>(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<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
- while let _ = try decoder.nextFieldNumber() {
- }
- }
- func traverse<V: SwiftProtobuf.Visitor>(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<D: SwiftProtobuf.Decoder>(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<V: SwiftProtobuf.Visitor>(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
- }
- }
|