Skip to content

Commit 434591a

Browse files
authored
Update availability to be in sync with Clock/Instant/Duration (#159)
1 parent 6e9a575 commit 434591a

14 files changed

+36
-36
lines changed

Diff for: Sources/AsyncAlgorithms/AsyncChunksOfCountOrSignalSequence.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -31,25 +31,25 @@ extension AsyncSequence {
3131
}
3232

3333
/// Creates an asynchronous sequence that creates chunks of a given `RangeReplaceableCollection` type of a given count or when an `AsyncTimerSequence` fires.
34-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
34+
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
3535
public func chunks<C: Clock, Collected: RangeReplaceableCollection>(ofCount count: Int, or timer: AsyncTimerSequence<C>, into: Collected.Type) -> AsyncChunksOfCountOrSignalSequence<Self, Collected, AsyncTimerSequence<C>> where Collected.Element == Element {
3636
AsyncChunksOfCountOrSignalSequence(self, count: count, signal: timer)
3737
}
3838

3939
/// Creates an asynchronous sequence that creates chunks of a given count or when an `AsyncTimerSequence` fires.
40-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
40+
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
4141
public func chunks<C: Clock>(ofCount count: Int, or timer: AsyncTimerSequence<C>) -> AsyncChunksOfCountOrSignalSequence<Self, [Element], AsyncTimerSequence<C>> {
4242
chunks(ofCount: count, or: timer, into: [Element].self)
4343
}
4444

4545
/// Creates an asynchronous sequence that creates chunks of a given `RangeReplaceableCollection` type when an `AsyncTimerSequence` fires.
46-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
46+
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
4747
public func chunked<C: Clock, Collected: RangeReplaceableCollection>(by timer: AsyncTimerSequence<C>, into: Collected.Type) -> AsyncChunksOfCountOrSignalSequence<Self, Collected, AsyncTimerSequence<C>> where Collected.Element == Element {
4848
AsyncChunksOfCountOrSignalSequence(self, count: nil, signal: timer)
4949
}
5050

5151
/// Creates an asynchronous sequence that creates chunks when an `AsyncTimerSequence` fires.
52-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
52+
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
5353
public func chunked<C: Clock>(by timer: AsyncTimerSequence<C>) -> AsyncChunksOfCountOrSignalSequence<Self, [Element], AsyncTimerSequence<C>> {
5454
chunked(by: timer, into: [Element].self)
5555
}

Diff for: Sources/AsyncAlgorithms/AsyncDebounceSequence.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,22 @@
1212
extension AsyncSequence {
1313
/// Creates an asynchronous sequence that emits the latest element after a given quiescence period
1414
/// has elapsed by using a specified Clock.
15-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
15+
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
1616
public func debounce<C: Clock>(for interval: C.Instant.Duration, tolerance: C.Instant.Duration? = nil, clock: C) -> AsyncDebounceSequence<Self, C> {
1717
AsyncDebounceSequence(self, interval: interval, tolerance: tolerance, clock: clock)
1818
}
1919

2020
/// Creates an asynchronous sequence that emits the latest element after a given quiescence period
2121
/// has elapsed.
22-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
22+
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
2323
public func debounce(for interval: Duration, tolerance: Duration? = nil) -> AsyncDebounceSequence<Self, ContinuousClock> {
2424
debounce(for: interval, tolerance: tolerance, clock: .continuous)
2525
}
2626
}
2727

2828
/// An `AsyncSequence` that emits the latest element after a given quiescence period
2929
/// has elapsed.
30-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
30+
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
3131
public struct AsyncDebounceSequence<Base: AsyncSequence, C: Clock>: Sendable
3232
where Base.AsyncIterator: Sendable, Base.Element: Sendable, Base: Sendable {
3333
let base: Base
@@ -43,7 +43,7 @@ public struct AsyncDebounceSequence<Base: AsyncSequence, C: Clock>: Sendable
4343
}
4444
}
4545

46-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
46+
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
4747
extension AsyncDebounceSequence: AsyncSequence {
4848
public typealias Element = Base.Element
4949

Diff for: Sources/AsyncAlgorithms/AsyncThrottleSequence.swift

+8-8
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,19 @@
1111

1212
extension AsyncSequence {
1313
/// Create a rate-limited `AsyncSequence` by emitting values at most every specified interval.
14-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
14+
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
1515
public func throttle<C: Clock, Reduced>(for interval: C.Instant.Duration, clock: C, reducing: @Sendable @escaping (Reduced?, Element) async -> Reduced) -> AsyncThrottleSequence<Self, C, Reduced> {
1616
AsyncThrottleSequence(self, interval: interval, clock: clock, reducing: reducing)
1717
}
1818

1919
/// Create a rate-limited `AsyncSequence` by emitting values at most every specified interval.
20-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
20+
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
2121
public func throttle<Reduced>(for interval: Duration, reducing: @Sendable @escaping (Reduced?, Element) async -> Reduced) -> AsyncThrottleSequence<Self, ContinuousClock, Reduced> {
2222
throttle(for: interval, clock: .continuous, reducing: reducing)
2323
}
2424

2525
/// Create a rate-limited `AsyncSequence` by emitting values at most every specified interval.
26-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
26+
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
2727
public func throttle<C: Clock>(for interval: C.Instant.Duration, clock: C, latest: Bool = true) -> AsyncThrottleSequence<Self, C, Element> {
2828
throttle(for: interval, clock: clock) { previous, element in
2929
if latest {
@@ -35,14 +35,14 @@ extension AsyncSequence {
3535
}
3636

3737
/// Create a rate-limited `AsyncSequence` by emitting values at most every specified interval.
38-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
38+
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
3939
public func throttle(for interval: Duration, latest: Bool = true) -> AsyncThrottleSequence<Self, ContinuousClock, Element> {
4040
throttle(for: interval, clock: .continuous, latest: latest)
4141
}
4242
}
4343

4444
/// A rate-limited `AsyncSequence` by emitting values at most every specified interval.
45-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
45+
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
4646
public struct AsyncThrottleSequence<Base: AsyncSequence, C: Clock, Reduced> {
4747
let base: Base
4848
let interval: C.Instant.Duration
@@ -57,7 +57,7 @@ public struct AsyncThrottleSequence<Base: AsyncSequence, C: Clock, Reduced> {
5757
}
5858
}
5959

60-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
60+
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
6161
extension AsyncThrottleSequence: AsyncSequence {
6262
public typealias Element = Reduced
6363

@@ -100,8 +100,8 @@ extension AsyncThrottleSequence: AsyncSequence {
100100
}
101101
}
102102

103-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
103+
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
104104
extension AsyncThrottleSequence: Sendable where Base: Sendable, Element: Sendable { }
105105

106-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
106+
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
107107
extension AsyncThrottleSequence.Iterator: Sendable where Base.AsyncIterator: Sendable { }

Diff for: Sources/AsyncAlgorithms/AsyncTimerSequence.swift

+5-5
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
//===----------------------------------------------------------------------===//
1111

1212
/// An `AsyncSequence` that produces elements at regular intervals.
13-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
13+
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
1414
public struct AsyncTimerSequence<C: Clock>: AsyncSequence {
1515
public typealias Element = C.Instant
1616

@@ -71,24 +71,24 @@ public struct AsyncTimerSequence<C: Clock>: AsyncSequence {
7171
}
7272
}
7373

74-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
74+
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
7575
extension AsyncTimerSequence {
7676
/// Create an `AsyncTimerSequence` with a given repeating interval.
7777
public static func repeating(every interval: C.Instant.Duration, tolerance: C.Instant.Duration? = nil, clock: C) -> AsyncTimerSequence<C> {
7878
return AsyncTimerSequence(interval: interval, tolerance: tolerance, clock: clock)
7979
}
8080
}
8181

82-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
82+
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
8383
extension AsyncTimerSequence where C == SuspendingClock {
8484
/// Create an `AsyncTimerSequence` with a given repeating interval.
8585
public static func repeating(every interval: Duration, tolerance: Duration? = nil) -> AsyncTimerSequence<SuspendingClock> {
8686
return AsyncTimerSequence(interval: interval, tolerance: tolerance, clock: SuspendingClock())
8787
}
8888
}
8989

90-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
90+
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
9191
extension AsyncTimerSequence: Sendable { }
9292

93-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
93+
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
9494
extension AsyncTimerSequence.Iterator: Sendable { }

Diff for: Sources/AsyncSequenceValidation/AsyncSequenceValidationDiagram.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
import _CAsyncSequenceValidationSupport
1313

14-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
14+
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
1515
@resultBuilder
1616
public struct AsyncSequenceValidationDiagram : Sendable {
1717
public struct Component<T> {

Diff for: Sources/AsyncSequenceValidation/Clock.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
import AsyncAlgorithms
1313

14-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
14+
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
1515
extension AsyncSequenceValidationDiagram {
1616
public struct Clock {
1717
let queue: WorkQueue
@@ -22,7 +22,7 @@ extension AsyncSequenceValidationDiagram {
2222
}
2323
}
2424

25-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
25+
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
2626
extension AsyncSequenceValidationDiagram.Clock: Clock {
2727
public struct Step: DurationProtocol, Hashable, CustomStringConvertible {
2828
internal var rawValue: Int

Diff for: Sources/AsyncSequenceValidation/Event.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//
1010
//===----------------------------------------------------------------------===//
1111

12-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
12+
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
1313
extension AsyncSequenceValidationDiagram {
1414
struct Failure: Error, Equatable { }
1515

Diff for: Sources/AsyncSequenceValidation/Expectation.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//
1010
//===----------------------------------------------------------------------===//
1111

12-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
12+
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
1313
extension AsyncSequenceValidationDiagram {
1414
public struct ExpectationResult: Sendable {
1515
public struct Event: Sendable {

Diff for: Sources/AsyncSequenceValidation/Input.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//
1010
//===----------------------------------------------------------------------===//
1111

12-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
12+
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
1313
extension AsyncSequenceValidationDiagram {
1414
public struct Specification: Sendable {
1515
public let specification: String

Diff for: Sources/AsyncSequenceValidation/Job.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
import _CAsyncSequenceValidationSupport
1313

14-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
14+
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
1515
struct Job: Hashable, @unchecked Sendable {
1616
let job: JobRef
1717

Diff for: Sources/AsyncSequenceValidation/TaskDriver.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import _CAsyncSequenceValidationSupport
2020
#endif
2121

2222
#if canImport(Darwin)
23-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
23+
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
2424
func start_thread(_ raw: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer? {
2525
Unmanaged<TaskDriver>.fromOpaque(raw).takeRetainedValue().run()
2626
return nil
@@ -34,7 +34,7 @@ func start_thread(_ raw: UnsafeMutableRawPointer?) -> UnsafeMutableRawPointer? {
3434
#error("TODO: Port TaskDriver threading to windows")
3535
#endif
3636

37-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
37+
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
3838
final class TaskDriver {
3939
let work: (TaskDriver) -> Void
4040
let queue: WorkQueue

Diff for: Sources/AsyncSequenceValidation/Test.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ internal func _swiftJobRun(
1919
_ executor: UnownedSerialExecutor
2020
) -> ()
2121

22-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
22+
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
2323
public protocol AsyncSequenceValidationTest: Sendable {
2424
var inputs: [AsyncSequenceValidationDiagram.Specification] { get }
2525
var output: AsyncSequenceValidationDiagram.Specification { get }
2626

2727
func test<C: Clock>(with clock: C, activeTicks: [C.Instant], output: AsyncSequenceValidationDiagram.Specification, _ event: (String) -> Void) async throws
2828
}
2929

30-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
30+
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
3131
extension AsyncSequenceValidationDiagram {
3232
struct Test<Operation: AsyncSequence>: AsyncSequenceValidationTest, @unchecked Sendable where Operation.Element == String {
3333
let inputs: [Specification]

Diff for: Sources/AsyncSequenceValidation/Theme.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,21 @@
99
//
1010
//===----------------------------------------------------------------------===//
1111

12-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
12+
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
1313
public protocol AsyncSequenceValidationTheme {
1414
func token(_ character: Character, inValue: Bool) -> AsyncSequenceValidationDiagram.Token
1515

1616
func description(for token: AsyncSequenceValidationDiagram.Token) -> String
1717
}
1818

19-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
19+
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
2020
extension AsyncSequenceValidationTheme where Self == AsyncSequenceValidationDiagram.ASCIITheme {
2121
public static var ascii: AsyncSequenceValidationDiagram.ASCIITheme {
2222
return AsyncSequenceValidationDiagram.ASCIITheme()
2323
}
2424
}
2525

26-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
26+
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
2727
extension AsyncSequenceValidationDiagram {
2828
public enum Token: Sendable {
2929
case step

Diff for: Sources/AsyncSequenceValidation/WorkQueue.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//
1010
//===----------------------------------------------------------------------===//
1111

12-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
12+
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
1313
struct WorkQueue: Sendable {
1414
enum Item: CustomStringConvertible, Comparable {
1515
case blocked(Token, AsyncSequenceValidationDiagram.Clock.Instant, UnsafeContinuation<Void, Error>)

0 commit comments

Comments
 (0)