|
10 | 10 | //===----------------------------------------------------------------------===//
|
11 | 11 | @_implementationOnly import OrderedCollections
|
12 | 12 |
|
13 |
| -struct OrderedSetContainer<Element: Hashable> { |
14 |
| - var contents: OrderedSet<Element> |
15 |
| - |
16 |
| - var isEmpty: Bool { contents.isEmpty } |
17 |
| - |
18 |
| - mutating func removeFirst() -> Element { |
19 |
| - contents.removeFirst() |
20 |
| - } |
21 |
| - |
22 |
| - mutating func remove(_ element: Element) -> Element? { |
23 |
| - contents.remove(element) |
24 |
| - } |
25 |
| - |
26 |
| - @discardableResult |
27 |
| - mutating func append(_ element: Element) -> (inserted: Bool, index: Int) { |
28 |
| - contents.append(element) |
29 |
| - } |
30 |
| - |
31 |
| - func map<T>(_ apply: (Element) throws -> T) rethrows -> [T] { |
32 |
| - try contents.map(apply) |
33 |
| - } |
34 |
| -} |
35 |
| - |
36 |
| -extension OrderedSetContainer: ExpressibleByArrayLiteral { |
37 |
| - typealias ArrayLiteralElement = OrderedSet<Element>.ArrayLiteralElement |
38 |
| - |
39 |
| - init(arrayLiteral elements: ArrayLiteralElement...) { |
40 |
| - contents = OrderedSet(elements) |
41 |
| - } |
42 |
| -} |
43 |
| - |
44 |
| -extension OrderedSetContainer: @unchecked Sendable where Element: Sendable { } |
45 |
| - |
| 13 | +// NOTE: this is only marked as unchecked since the swift-collections tag is before auditing for Sendable |
| 14 | +extension OrderedSet: @unchecked Sendable where Element: Sendable { } |
46 | 15 |
|
47 | 16 | struct ChannelStateMachine<Element: Sendable, Failure: Error>: Sendable {
|
48 | 17 | private struct SuspendedProducer: Hashable, Sendable {
|
@@ -87,9 +56,9 @@ struct ChannelStateMachine<Element: Sendable, Failure: Error>: Sendable {
|
87 | 56 |
|
88 | 57 | private enum State: Sendable {
|
89 | 58 | case channeling(
|
90 |
| - suspendedProducers: OrderedSetContainer<SuspendedProducer>, |
| 59 | + suspendedProducers: OrderedSet<SuspendedProducer>, |
91 | 60 | cancelledProducers: Set<SuspendedProducer>,
|
92 |
| - suspendedConsumers: OrderedSetContainer<SuspendedConsumer>, |
| 61 | + suspendedConsumers: OrderedSet<SuspendedConsumer>, |
93 | 62 | cancelledConsumers: Set<SuspendedConsumer>
|
94 | 63 | )
|
95 | 64 | case terminated(Termination)
|
|
0 commit comments