Skip to content

Commit b92b5bd

Browse files
authored
Merge pull request #168 from swhitty/sendable-metatype
Swift 6.2 SendableMetatype
2 parents d324138 + 4526c0f commit b92b5bd

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

FlyingFox/Sources/WebSocket/AsyncStream+WSFrame.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,11 @@ extension AsyncThrowingStream<WSFrame, any Error> {
4848

4949
extension AsyncStream<WSFrame> {
5050

51-
static func protocolFrames<S: AsyncSequence>(from frames: S) -> Self where S.Element == WSFrame {
51+
#if compiler(<6.2)
52+
typealias SendableMetatype = Any
53+
#endif
54+
55+
static func protocolFrames<S: AsyncSequence & SendableMetatype>(from frames: S) -> Self where S.Element == WSFrame {
5256
let iterator = Iterator(from: frames)
5357
return AsyncStream<WSFrame> {
5458
do {

FlyingSocks/Sources/SocketPool.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,17 @@
3232
import Dispatch
3333
import Foundation
3434

35+
#if compiler(>=6.2)
36+
public protocol EventQueue: SendableMetatype {
37+
mutating func open() throws
38+
mutating func stop() throws
39+
mutating func close() throws
40+
41+
mutating func addEvents(_ events: Socket.Events, for socket: Socket.FileDescriptor) throws
42+
mutating func removeEvents(_ events: Socket.Events, for socket: Socket.FileDescriptor) throws
43+
func getNotifications() throws -> [EventNotification]
44+
}
45+
#else
3546
public protocol EventQueue {
3647
mutating func open() throws
3748
mutating func stop() throws
@@ -41,6 +52,7 @@ public protocol EventQueue {
4152
mutating func removeEvents(_ events: Socket.Events, for socket: Socket.FileDescriptor) throws
4253
func getNotifications() throws -> [EventNotification]
4354
}
55+
#endif
4456

4557
public struct EventNotification: Equatable, Sendable {
4658
public var file: Socket.FileDescriptor

0 commit comments

Comments
 (0)