uses_a_transitively2.pb.swift 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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: Tests/Test2/uses_a_transitively2.proto
  7. //
  8. // For information on using the generated types, please see the documentation:
  9. // https://github.com/apple/swift-protobuf/
  10. import SwiftProtobuf
  11. import ImportsImportsAPublicly
  12. // If the compiler emits an error on this type, it is because this file
  13. // was generated by a version of the `protoc` Swift plug-in that is
  14. // incompatible with the version of SwiftProtobuf to which you are linking.
  15. // Please ensure that you are building against the same version of the API
  16. // that was used to generate this file.
  17. fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
  18. struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
  19. typealias Version = _2
  20. }
  21. public struct UsesATransitively2: Sendable {
  22. // SwiftProtobuf.Message conformance is added in an extension below. See the
  23. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  24. // methods supported on all messages.
  25. public var a: ModuleA.A {
  26. get {return _a ?? ModuleA.A()}
  27. set {_a = newValue}
  28. }
  29. /// Returns true if `a` has been explicitly set.
  30. public var hasA: Bool {return self._a != nil}
  31. /// Clears the value of `a`. Subsequent reads from it will return its default value.
  32. public mutating func clearA() {self._a = nil}
  33. public var e: ModuleA.E {
  34. get {return _e ?? .unset}
  35. set {_e = newValue}
  36. }
  37. /// Returns true if `e` has been explicitly set.
  38. public var hasE: Bool {return self._e != nil}
  39. /// Clears the value of `e`. Subsequent reads from it will return its default value.
  40. public mutating func clearE() {self._e = nil}
  41. public var unknownFields = SwiftProtobuf.UnknownStorage()
  42. public init() {}
  43. fileprivate var _a: ModuleA.A? = nil
  44. fileprivate var _e: ModuleA.E? = nil
  45. }
  46. // MARK: - Code below here is support for the SwiftProtobuf runtime.
  47. extension UsesATransitively2: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  48. public static let protoMessageName: String = "UsesATransitively2"
  49. public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  50. 111: .same(proto: "a"),
  51. 122: .same(proto: "e"),
  52. ]
  53. public var isInitialized: Bool {
  54. if let v = self._a, !v.isInitialized {return false}
  55. return true
  56. }
  57. public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  58. while let fieldNumber = try decoder.nextFieldNumber() {
  59. // The use of inline closures is to circumvent an issue where the compiler
  60. // allocates stack space for every case branch when no optimizations are
  61. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  62. switch fieldNumber {
  63. case 111: try { try decoder.decodeSingularMessageField(value: &self._a) }()
  64. case 122: try { try decoder.decodeSingularEnumField(value: &self._e) }()
  65. default: break
  66. }
  67. }
  68. }
  69. public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  70. // The use of inline closures is to circumvent an issue where the compiler
  71. // allocates stack space for every if/case branch local when no optimizations
  72. // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
  73. // https://github.com/apple/swift-protobuf/issues/1182
  74. try { if let v = self._a {
  75. try visitor.visitSingularMessageField(value: v, fieldNumber: 111)
  76. } }()
  77. try { if let v = self._e {
  78. try visitor.visitSingularEnumField(value: v, fieldNumber: 122)
  79. } }()
  80. try unknownFields.traverse(visitor: &visitor)
  81. }
  82. public static func ==(lhs: UsesATransitively2, rhs: UsesATransitively2) -> Bool {
  83. if lhs._a != rhs._a {return false}
  84. if lhs._e != rhs._e {return false}
  85. if lhs.unknownFields != rhs.unknownFields {return false}
  86. return true
  87. }
  88. }