Skip to content

Commit

Permalink
Explicitly mark the AsyncSequence iterators as non Sendable (#490)
Browse files Browse the repository at this point in the history
  • Loading branch information
fabianfett committed Jun 27, 2024
1 parent f55caa7 commit 200a94a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import PackageDescription

let swiftSettings: [SwiftSetting] = [
.enableUpcomingFeature("StrictConcurrency")
.enableUpcomingFeature("StrictConcurrency"),
]

let package = Package(
Expand Down
3 changes: 3 additions & 0 deletions Sources/PostgresNIO/New/PostgresNotificationSequence.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@ public struct PostgresNotificationSequence: AsyncSequence, Sendable {
}
}
}

@available(*, unavailable)
extension PostgresNotificationSequence.AsyncIterator: Sendable {}
2 changes: 1 addition & 1 deletion Sources/PostgresNIO/New/PostgresQuery.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ extension PostgresQuery: ExpressibleByStringInterpolation {
}

extension PostgresQuery {
public struct StringInterpolation: StringInterpolationProtocol {
public struct StringInterpolation: StringInterpolationProtocol, Sendable {
public typealias StringLiteralType = String

@usableFromInline
Expand Down
5 changes: 4 additions & 1 deletion Sources/PostgresNIO/New/PostgresRowSequence.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import NIOConcurrencyHelpers
/// An async sequence of ``PostgresRow``s.
///
/// - Note: This is a struct to allow us to move to a move only type easily once they become available.
public struct PostgresRowSequence: AsyncSequence {
public struct PostgresRowSequence: AsyncSequence, Sendable {
public typealias Element = PostgresRow

typealias BackingSequence = NIOThrowingAsyncSequenceProducer<DataRow, Error, AdaptiveRowBuffer, PSQLRowStream>
Expand Down Expand Up @@ -56,6 +56,9 @@ extension PostgresRowSequence {
}
}

@available(*, unavailable)
extension PostgresRowSequence.AsyncIterator: Sendable {}

extension PostgresRowSequence {
public func collect() async throws -> [PostgresRow] {
var result = [PostgresRow]()
Expand Down

0 comments on commit 200a94a

Please sign in to comment.