uses_a_transitively2.pb.swift 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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 {_a ?? ModuleA.A()}
  27. set {_a = newValue}
  28. }
  29. /// Returns true if `a` has been explicitly set.
  30. public var hasA: Bool {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 {_e ?? .unset}
  35. set {_e = newValue}
  36. }
  37. /// Returns true if `e` has been explicitly set.
  38. public var hasE: Bool {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(bytecode: "\0\u{2}o\u{1}a\0\u{2}\u{b}e\0")
  50. public var isInitialized: Bool {
  51. if let v = self._a, !v.isInitialized {return false}
  52. return true
  53. }
  54. public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  55. while let fieldNumber = try decoder.nextFieldNumber() {
  56. // The use of inline closures is to circumvent an issue where the compiler
  57. // allocates stack space for every case branch when no optimizations are
  58. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  59. switch fieldNumber {
  60. case 111: try { try decoder.decodeSingularMessageField(value: &self._a) }()
  61. case 122: try { try decoder.decodeSingularEnumField(value: &self._e) }()
  62. default: break
  63. }
  64. }
  65. }
  66. public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  67. // The use of inline closures is to circumvent an issue where the compiler
  68. // allocates stack space for every if/case branch local when no optimizations
  69. // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
  70. // https://github.com/apple/swift-protobuf/issues/1182
  71. try { if let v = self._a {
  72. try visitor.visitSingularMessageField(value: v, fieldNumber: 111)
  73. } }()
  74. try { if let v = self._e {
  75. try visitor.visitSingularEnumField(value: v, fieldNumber: 122)
  76. } }()
  77. try unknownFields.traverse(visitor: &visitor)
  78. }
  79. public static func ==(lhs: UsesATransitively2, rhs: UsesATransitively2) -> Bool {
  80. if lhs._a != rhs._a {return false}
  81. if lhs._e != rhs._e {return false}
  82. if lhs.unknownFields != rhs.unknownFields {return false}
  83. return true
  84. }
  85. }