ProtobufMap.swift 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. // Sources/SwiftProtobuf/ProtobufMap.swift - Map<> support
  2. //
  3. // Copyright (c) 2014 - 2016 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. /// Generic type representing proto map<> fields.
  12. ///
  13. // -----------------------------------------------------------------------------
  14. import Foundation
  15. /// SwiftProtobuf Internal: Support for Encoding/Decoding.
  16. public struct _ProtobufMap<KeyType: MapKeyType, ValueType: FieldType> {
  17. public typealias Key = KeyType.BaseType
  18. public typealias Value = ValueType.BaseType
  19. public typealias BaseType = [Key: Value]
  20. }
  21. /// SwiftProtobuf Internal: Support for Encoding/Decoding.
  22. public struct _ProtobufMessageMap<KeyType: MapKeyType, ValueType: Message & Hashable> {
  23. public typealias Key = KeyType.BaseType
  24. public typealias Value = ValueType
  25. public typealias BaseType = [Key: Value]
  26. }
  27. /// SwiftProtobuf Internal: Support for Encoding/Decoding.
  28. public struct _ProtobufEnumMap<KeyType: MapKeyType, ValueType: Enum> {
  29. public typealias Key = KeyType.BaseType
  30. public typealias Value = ValueType
  31. public typealias BaseType = [Key: Value]
  32. }