You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+6-6Lines changed: 6 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -13,18 +13,18 @@ Since this algorithm is not easy to get right and the implementation in [swift-a
13
13
14
14
The library comes with two free functions, one with a generic clock. And another one which uses the `ContinuousClock` as default.
15
15
```swift
16
-
publicfuncwithDeadline<C, T>(
16
+
publicfuncwithDeadline<C, R>(
17
17
untilinstant: C.Instant,
18
18
tolerance: C.Instant.Duration?=nil,
19
19
clock: C,
20
-
operation: @escaping@Sendable () asyncthrows->T
21
-
) asyncthrows->Twhere C:Clock, T:Sendable { ... }
20
+
operation: @Sendable () asyncthrows->R
21
+
) asyncthrows->Rwhere C:Clock, R:Sendable { ... }
22
22
23
-
publicfuncwithDeadline<T>(
23
+
publicfuncwithDeadline<R>(
24
24
untilinstant: ContinuousClock.Instant,
25
25
tolerance: ContinuousClock.Instant.Duration?=nil,
26
-
operation: @escaping@Sendable () asyncthrows->T
27
-
) asyncthrows->TwhereT:Sendable { ... }
26
+
operation: @Sendable () asyncthrows->R
27
+
) asyncthrows->RwhereR:Sendable { ... }
28
28
```
29
29
30
30
This function provides a mechanism for enforcing timeouts on asynchronous operations that lack native deadline support. It creates a `TaskGroup` with two concurrent tasks: the provided operation and a sleep task.
0 commit comments