Skip to content

Commit

Permalink
Add missing availibility flags (#99)
Browse files Browse the repository at this point in the history
  • Loading branch information
fabianfett authored Nov 15, 2023
1 parent 5a81dd7 commit a476f69
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
//===----------------------------------------------------------------------===//

/// A description of a single shard that is part of a redis cluster
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
public protocol RedisClusterShardDescriptionProtocol: Identifiable, Sendable {
associatedtype NodeDescription: RedisClusterNodeDescriptionProtocol

Expand Down
3 changes: 3 additions & 0 deletions Sources/RediStack/Cluster/SwiftPolyfill.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,19 @@

/// We use this protocol internally to abstract over TaskGroups. On Linux we can always use a `DiscardingTaskGroup`,
/// but to support Swift 5.8 on macOS we need to fallback to the original TaskGroup.
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
protocol DiscardingTaskGroupProtocol {
mutating func addTask(priority: TaskPriority?, operation: @escaping @Sendable () async -> Void)
}

@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
extension DiscardingTaskGroupProtocol {
mutating func addTask(_ operation: @escaping @Sendable () async -> Void) {
self.addTask(priority: nil, operation: operation)
}
}

@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
extension TaskGroup: DiscardingTaskGroupProtocol where ChildTaskResult == Void {}

#if swift(>=5.9) || (swift(>=5.8) && os(Linux))
Expand Down

0 comments on commit a476f69

Please sign in to comment.