Google_Protobuf_Edition+Extensions.swift 1.2 KB

1234567891011121314151617181920212223242526272829303132
  1. // Sources/SwiftProtobufPluginLibrary/Google_Protobuf_Edition+Extensions.swift - Google_Protobuf_Edition extensions
  2. //
  3. // Copyright (c) 2014 - 2024 Apple Inc. and the project authors
  4. // Licensed under Apache License v2.0 with Runtime Library Exception
  5. //
  6. // See LICENSE.txt for license information:
  7. // https://github.com/apple/swift-protobuf/blob/main/LICENSE.txt
  8. //
  9. // -----------------------------------------------------------------------------
  10. ///
  11. /// Extensions to `Google_Protobuf_Edition` provide some simple helpers.
  12. ///
  13. // -----------------------------------------------------------------------------
  14. import Foundation
  15. import SwiftProtobuf
  16. /// The spec for editions calls out them being ordered and comparable.
  17. /// https://github.com/protocolbuffers/protobuf/blob/main/docs/design/editions/edition-naming.md
  18. #if compiler(>=6)
  19. extension Google_Protobuf_Edition: Comparable {
  20. public static func < (lhs: Google_Protobuf_Edition, rhs: Google_Protobuf_Edition) -> Bool {
  21. lhs.rawValue < rhs.rawValue
  22. }
  23. }
  24. #else
  25. extension Google_Protobuf_Edition: Comparable {
  26. public static func < (lhs: Google_Protobuf_Edition, rhs: Google_Protobuf_Edition) -> Bool {
  27. lhs.rawValue < rhs.rawValue
  28. }
  29. }
  30. #endif