Skip to content

Commit 3560428

Browse files
authored
Update README.md
1 parent b643b53 commit 3560428

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,18 @@ Since this algorithm is not easy to get right and the implementation in [swift-a
1313

1414
The library comes with two free functions, one with a generic clock. And another one which uses the `ContinuousClock` as default.
1515
```swift
16-
public func withDeadline<C, T>(
16+
public func withDeadline<C, R>(
1717
until instant: C.Instant,
1818
tolerance: C.Instant.Duration? = nil,
1919
clock: C,
20-
operation: @escaping @Sendable () async throws -> T
21-
) async throws -> T where C: Clock, T: Sendable { ... }
20+
operation: @Sendable () async throws -> R
21+
) async throws -> R where C: Clock, R: Sendable { ... }
2222

23-
public func withDeadline<T>(
23+
public func withDeadline<R>(
2424
until instant: ContinuousClock.Instant,
2525
tolerance: ContinuousClock.Instant.Duration? = nil,
26-
operation: @escaping @Sendable () async throws -> T
27-
) async throws -> T where T: Sendable { ... }
26+
operation: @Sendable () async throws -> R
27+
) async throws -> R where R: Sendable { ... }
2828
```
2929

3030
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

Comments
 (0)