Skip to content

Commit 0ec899a

Browse files
Make NIO[Throwing]AsyncSequenceProducer.Source Sendable (#2459)
1 parent 60c54a7 commit 0ec899a

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

Sources/NIOCore/AsyncSequences/NIOAsyncSequenceProducer.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,3 +329,5 @@ extension NIOAsyncSequenceProducer {
329329
@available(*, unavailable)
330330
extension NIOAsyncSequenceProducer.AsyncIterator: Sendable {}
331331

332+
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
333+
extension NIOAsyncSequenceProducer.Source: Sendable {}

Sources/NIOCore/AsyncSequences/NIOThrowingAsyncSequenceProducer.swift

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public struct NIOThrowingAsyncSequenceProducer<
114114

115115
return .init(source: source, sequence: sequence)
116116
}
117-
117+
118118
/// Initializes a new ``NIOThrowingAsyncSequenceProducer`` and a ``NIOThrowingAsyncSequenceProducer/Source``.
119119
///
120120
/// - Important: This method returns a struct containing a ``NIOThrowingAsyncSequenceProducer/Source`` and
@@ -229,7 +229,7 @@ extension NIOThrowingAsyncSequenceProducer {
229229
///
230230
/// - Note: This struct has reference semantics. Once all copies of a source have been dropped ``NIOThrowingAsyncSequenceProducer/Source/finish()``.
231231
/// This will resume any suspended continuation.
232-
public struct Source: Sendable {
232+
public struct Source {
233233
/// This class is needed to hook the deinit to observe once all references to the ``NIOThrowingAsyncSequenceProducer/Source`` are dropped.
234234
///
235235
/// - Important: This is safe to be unchecked ``Sendable`` since the `storage` is ``Sendable`` and `immutable`.
@@ -573,7 +573,7 @@ extension NIOThrowingAsyncSequenceProducer {
573573
} else {
574574
continuation.resume(returning: nil)
575575
}
576-
576+
577577
let delegate = self._delegate
578578
self._delegate = nil
579579

@@ -966,7 +966,7 @@ extension NIOThrowingAsyncSequenceProducer {
966966
switch self._state {
967967
case .initial(_, let iteratorInitialized):
968968
// This can happen if the `Task` that calls `next()` is already cancelled.
969-
969+
970970
// We have deprecated the generic Failure type in the public API and Failure should
971971
// now be `Swift.Error`. However, if users have not migrated to the new API they could
972972
// still use a custom generic Error type and this cast might fail.
@@ -984,7 +984,7 @@ extension NIOThrowingAsyncSequenceProducer {
984984
} else {
985985
self._state = .finished(iteratorInitialized: iteratorInitialized)
986986
}
987-
987+
988988
return .none
989989

990990
case .streaming(_, _, .some(let continuation), _, let iteratorInitialized):
@@ -1170,3 +1170,6 @@ extension NIOThrowingAsyncSequenceProducer {
11701170
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
11711171
@available(*, unavailable)
11721172
extension NIOThrowingAsyncSequenceProducer.AsyncIterator: Sendable {}
1173+
1174+
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
1175+
extension NIOThrowingAsyncSequenceProducer.Source: Sendable {}

0 commit comments

Comments
 (0)