mirror of
https://github.com/apple/swift-collections
synced 2026-11-26 04:47:48 +00:00
[PersistentDictionary] PersistentDictionary, .Iterator, .Index, .Keys, .Keys.Iterator, .Values, .Values.Iterator: Explicitly conform to Sendable when Key and Value are both Sendable
This commit is contained in:
1 parent
4b04acfe65
commit
3238b9b575
5 files changed
+44
No files matched your search
+5
@@ -32,6 +32,11 @@ extension PersistentDictionary {
|
||||
}
|
||||
}
|
||||
|
||||
#if swift(>=5.5)
|
||||
extension PersistentDictionary.Index: @unchecked Sendable
|
||||
where Key: Sendable, Value: Sendable {}
|
||||
#endif
|
||||
|
||||
extension PersistentDictionary.Index: Equatable {
|
||||
@inlinable
|
||||
public static func ==(left: Self, right: Self) -> Bool {
|
||||
|
||||
@@ -34,6 +34,10 @@ extension PersistentDictionary {
|
||||
}
|
||||
}
|
||||
|
||||
#if swift(>=5.5)
|
||||
extension PersistentDictionary.Keys: Sendable
|
||||
where Key: Sendable, Value: Sendable {}
|
||||
#endif
|
||||
|
||||
extension PersistentDictionary.Keys: Sequence {
|
||||
public typealias Element = Key
|
||||
@@ -74,6 +78,11 @@ extension PersistentDictionary.Keys: Sequence {
|
||||
}
|
||||
}
|
||||
|
||||
#if swift(>=5.5)
|
||||
extension PersistentDictionary.Keys.Iterator: Sendable
|
||||
where Key: Sendable, Value: Sendable {}
|
||||
#endif
|
||||
|
||||
extension PersistentDictionary.Keys: BidirectionalCollection {
|
||||
public typealias Index = PersistentDictionary.Index
|
||||
|
||||
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This source file is part of the Swift Collections open source project
|
||||
//
|
||||
// Copyright (c) 2022 Apple Inc. and the Swift project authors
|
||||
// Licensed under Apache License v2.0 with Runtime Library Exception
|
||||
//
|
||||
// See https://swift.org/LICENSE.txt for license information
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if swift(>=5.5)
|
||||
extension PersistentDictionary: @unchecked Sendable
|
||||
where Key: Sendable, Value: Sendable {}
|
||||
#endif
|
||||
@@ -41,6 +41,11 @@ extension PersistentDictionary: Sequence {
|
||||
}
|
||||
}
|
||||
|
||||
#if swift(>=5.5)
|
||||
extension PersistentDictionary.Iterator: @unchecked Sendable
|
||||
where Key: Sendable, Value: Sendable {}
|
||||
#endif
|
||||
|
||||
extension PersistentDictionary.Iterator: IteratorProtocol {
|
||||
public typealias Element = (key: Key, value: Value)
|
||||
|
||||
|
||||
@@ -45,6 +45,11 @@ extension PersistentDictionary {
|
||||
}
|
||||
}
|
||||
|
||||
#if swift(>=5.5)
|
||||
extension PersistentDictionary.Values: Sendable
|
||||
where Key: Sendable, Value: Sendable {}
|
||||
#endif
|
||||
|
||||
extension PersistentDictionary.Values: Sequence {
|
||||
public typealias Element = Value
|
||||
|
||||
@@ -72,6 +77,11 @@ extension PersistentDictionary.Values: Sequence {
|
||||
}
|
||||
}
|
||||
|
||||
#if swift(>=5.5)
|
||||
extension PersistentDictionary.Values.Iterator: Sendable
|
||||
where Key: Sendable, Value: Sendable {}
|
||||
#endif
|
||||
|
||||
// Note: This cannot be a MutableCollection because its subscript setter
|
||||
// needs to invalidate indices.
|
||||
extension PersistentDictionary.Values: BidirectionalCollection {
|
||||
|
||||
Reference in new issue
Block a user