echo.pb.swift 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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: echo.proto
  7. //
  8. // For information on using the generated types, please see the documentation:
  9. // https://github.com/apple/swift-protobuf/
  10. // Copyright (c) 2015, Google Inc.
  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. public struct Echo_EchoRequest: 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. /// The text of a message to be echoed.
  39. public var text: String = String()
  40. public var unknownFields = SwiftProtobuf.UnknownStorage()
  41. public init() {}
  42. }
  43. public struct Echo_EchoResponse: 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. /// The text of an echo response.
  48. public var text: String = String()
  49. public var unknownFields = SwiftProtobuf.UnknownStorage()
  50. public init() {}
  51. }
  52. // MARK: - Code below here is support for the SwiftProtobuf runtime.
  53. fileprivate let _protobuf_package = "echo"
  54. extension Echo_EchoRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  55. public static let protoMessageName: String = _protobuf_package + ".EchoRequest"
  56. public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  57. 1: .same(proto: "text"),
  58. ]
  59. public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  60. while let fieldNumber = try decoder.nextFieldNumber() {
  61. // The use of inline closures is to circumvent an issue where the compiler
  62. // allocates stack space for every case branch when no optimizations are
  63. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  64. switch fieldNumber {
  65. case 1: try { try decoder.decodeSingularStringField(value: &self.text) }()
  66. default: break
  67. }
  68. }
  69. }
  70. public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  71. if !self.text.isEmpty {
  72. try visitor.visitSingularStringField(value: self.text, fieldNumber: 1)
  73. }
  74. try unknownFields.traverse(visitor: &visitor)
  75. }
  76. public static func ==(lhs: Echo_EchoRequest, rhs: Echo_EchoRequest) -> Bool {
  77. if lhs.text != rhs.text {return false}
  78. if lhs.unknownFields != rhs.unknownFields {return false}
  79. return true
  80. }
  81. }
  82. extension Echo_EchoResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  83. public static let protoMessageName: String = _protobuf_package + ".EchoResponse"
  84. public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  85. 1: .same(proto: "text"),
  86. ]
  87. public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  88. while let fieldNumber = try decoder.nextFieldNumber() {
  89. // The use of inline closures is to circumvent an issue where the compiler
  90. // allocates stack space for every case branch when no optimizations are
  91. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  92. switch fieldNumber {
  93. case 1: try { try decoder.decodeSingularStringField(value: &self.text) }()
  94. default: break
  95. }
  96. }
  97. }
  98. public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  99. if !self.text.isEmpty {
  100. try visitor.visitSingularStringField(value: self.text, fieldNumber: 1)
  101. }
  102. try unknownFields.traverse(visitor: &visitor)
  103. }
  104. public static func ==(lhs: Echo_EchoResponse, rhs: Echo_EchoResponse) -> Bool {
  105. if lhs.text != rhs.text {return false}
  106. if lhs.unknownFields != rhs.unknownFields {return false}
  107. return true
  108. }
  109. }