3232#if compiler(>=6.0)
3333import Foundation
3434
35- public struct Timeout : Sendable {
35+ @available ( * , unavailable, renamed: " TimeoutController " )
36+ public typealias Timeout = TimeoutController
37+
38+ public struct TimeoutController : Sendable {
3639 fileprivate var canary : @Sendable ( ) -> Void
3740 fileprivate let shared : SharedState
3841
@@ -74,7 +77,7 @@ public struct Timeout: Sendable {
7477}
7578
7679@available ( macOS 13 . 0 , iOS 16 . 0 , tvOS 16 . 0 , watchOS 9 . 0 , * )
77- public extension Timeout {
80+ public extension TimeoutController {
7881
7982 @discardableResult
8083 func expire< C: Clock > (
@@ -97,7 +100,7 @@ public extension Timeout {
97100 }
98101}
99102
100- extension Timeout {
103+ extension TimeoutController {
101104
102105 init (
103106 canary: @escaping @Sendable ( ) -> Void ,
@@ -156,13 +159,13 @@ extension Timeout {
156159func withNonEscapingTimeout< T> (
157160 _ timeout: @escaping @Sendable ( ) async throws -> Never ,
158161 isolation: isolated ( any Actor ) ? = #isolation,
159- body: ( Timeout ) async throws -> sending T
162+ body: ( TimeoutController ) async throws -> sending T
160163) async throws -> sending T {
161164 // canary ensuring Timeout does not escape at runtime.
162165 // Swift 6.2 and later enforce at compile time with ~Escapable
163166 try await withoutActuallyEscaping ( { @Sendable in } ) { escaping in
164167 _ = isolation
165- let timeout = Timeout ( canary: escaping, pending: timeout)
168+ let timeout = TimeoutController ( canary: escaping, pending: timeout)
166169 return try await Transferring ( body ( timeout) )
167170 } . value
168171}
0 commit comments