2
0

helloworld.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: helloworld.proto
  7. //
  8. // For information on using the generated types, please see the documentation:
  9. // https://github.com/apple/swift-protobuf/
  10. /// Copyright 2015 gRPC authors.
  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. /// The request message containing the user's name.
  35. struct Helloworld_HelloRequest: Sendable {
  36. // SwiftProtobuf.Message conformance is added in an extension below. See the
  37. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  38. // methods supported on all messages.
  39. var name: String = String()
  40. var unknownFields = SwiftProtobuf.UnknownStorage()
  41. init() {}
  42. }
  43. /// The response message containing the greetings
  44. struct Helloworld_HelloReply: Sendable {
  45. // SwiftProtobuf.Message conformance is added in an extension below. See the
  46. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  47. // methods supported on all messages.
  48. var message: String = String()
  49. var unknownFields = SwiftProtobuf.UnknownStorage()
  50. init() {}
  51. }
  52. // MARK: - Code below here is support for the SwiftProtobuf runtime.
  53. fileprivate let _protobuf_package = "helloworld"
  54. extension Helloworld_HelloRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  55. static let protoMessageName: String = _protobuf_package + ".HelloRequest"
  56. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  57. 1: .same(proto: "name"),
  58. ]
  59. 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.name) }()
  66. default: break
  67. }
  68. }
  69. }
  70. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  71. if !self.name.isEmpty {
  72. try visitor.visitSingularStringField(value: self.name, fieldNumber: 1)
  73. }
  74. try unknownFields.traverse(visitor: &visitor)
  75. }
  76. static func ==(lhs: Helloworld_HelloRequest, rhs: Helloworld_HelloRequest) -> Bool {
  77. if lhs.name != rhs.name {return false}
  78. if lhs.unknownFields != rhs.unknownFields {return false}
  79. return true
  80. }
  81. }
  82. extension Helloworld_HelloReply: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  83. static let protoMessageName: String = _protobuf_package + ".HelloReply"
  84. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  85. 1: .same(proto: "message"),
  86. ]
  87. 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.message) }()
  94. default: break
  95. }
  96. }
  97. }
  98. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  99. if !self.message.isEmpty {
  100. try visitor.visitSingularStringField(value: self.message, fieldNumber: 1)
  101. }
  102. try unknownFields.traverse(visitor: &visitor)
  103. }
  104. static func ==(lhs: Helloworld_HelloReply, rhs: Helloworld_HelloReply) -> Bool {
  105. if lhs.message != rhs.message {return false}
  106. if lhs.unknownFields != rhs.unknownFields {return false}
  107. return true
  108. }
  109. }