helloworld.pb.swift 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. // DO NOT EDIT.
  2. // swift-format-ignore-file
  3. //
  4. // Generated by the Swift generator plugin for the protocol buffer compiler.
  5. // Source: helloworld.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. /// The request message containing the user's name.
  34. public struct Helloworld_HelloRequest {
  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. public var name: String = String()
  39. public var unknownFields = SwiftProtobuf.UnknownStorage()
  40. public init() {}
  41. }
  42. /// The response message containing the greetings.
  43. public struct Helloworld_HelloReply {
  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. public var message: String = String()
  48. public var unknownFields = SwiftProtobuf.UnknownStorage()
  49. public init() {}
  50. }
  51. #if swift(>=5.5) && canImport(_Concurrency)
  52. extension Helloworld_HelloRequest: @unchecked Sendable {}
  53. extension Helloworld_HelloReply: @unchecked Sendable {}
  54. #endif // swift(>=5.5) && canImport(_Concurrency)
  55. // MARK: - Code below here is support for the SwiftProtobuf runtime.
  56. fileprivate let _protobuf_package = "helloworld"
  57. extension Helloworld_HelloRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  58. public static let protoMessageName: String = _protobuf_package + ".HelloRequest"
  59. public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  60. 1: .same(proto: "name"),
  61. ]
  62. public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  63. while let fieldNumber = try decoder.nextFieldNumber() {
  64. // The use of inline closures is to circumvent an issue where the compiler
  65. // allocates stack space for every case branch when no optimizations are
  66. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  67. switch fieldNumber {
  68. case 1: try { try decoder.decodeSingularStringField(value: &self.name) }()
  69. default: break
  70. }
  71. }
  72. }
  73. public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  74. if !self.name.isEmpty {
  75. try visitor.visitSingularStringField(value: self.name, fieldNumber: 1)
  76. }
  77. try unknownFields.traverse(visitor: &visitor)
  78. }
  79. public static func ==(lhs: Helloworld_HelloRequest, rhs: Helloworld_HelloRequest) -> Bool {
  80. if lhs.name != rhs.name {return false}
  81. if lhs.unknownFields != rhs.unknownFields {return false}
  82. return true
  83. }
  84. }
  85. extension Helloworld_HelloReply: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  86. public static let protoMessageName: String = _protobuf_package + ".HelloReply"
  87. public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  88. 1: .same(proto: "message"),
  89. ]
  90. public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  91. while let fieldNumber = try decoder.nextFieldNumber() {
  92. // The use of inline closures is to circumvent an issue where the compiler
  93. // allocates stack space for every case branch when no optimizations are
  94. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  95. switch fieldNumber {
  96. case 1: try { try decoder.decodeSingularStringField(value: &self.message) }()
  97. default: break
  98. }
  99. }
  100. }
  101. public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  102. if !self.message.isEmpty {
  103. try visitor.visitSingularStringField(value: self.message, fieldNumber: 1)
  104. }
  105. try unknownFields.traverse(visitor: &visitor)
  106. }
  107. public static func ==(lhs: Helloworld_HelloReply, rhs: Helloworld_HelloReply) -> Bool {
  108. if lhs.message != rhs.message {return false}
  109. if lhs.unknownFields != rhs.unknownFields {return false}
  110. return true
  111. }
  112. }