Files
Orhan Yigit YazicilarandGeorge Barnett 774c274789 Split RequestResponseHandlers into Sendable and non-Sendable variants (#279)
Motivation:
`RequestResponseHandler` and `RequestResponseWithIDHandler` previously
allowed non-`Sendable` Requests to move across event loops by wrapping
it in `UnsafeTransfer`, which disabled the compiler's sendability
checking. Requiring every Response to be `Sendable` would solve the
safety issue but it limits how the handlers can be used.

Modifications:
* Extracted the common logic of both handlers into a single state
machine.
* Modified the original implementations to have Request conform to
`Sendable`
* Introduced two new variants that don't care if the Request is
`Sendable` as promises moving to different event loops would be failed
with an error.
* Removed the UnsafeTransfer type as it is not used anymore.
* Added unit tests to confirm that the Sendable variants allow for
promises for different event loops and non-Sendable variants fail the
promises with an Error.

Result:
* Compiler's sendability checks are restored for the handlers.

---------

Co-authored-by: George Barnett <gbarnett@apple.com>
2025-07-03 13:00:21 +01:00

10 lines
101 B
Plaintext

.DS_Store
/.build
/Packages
/*.xcodeproj
Package.pins
*.pem
/docs
Package.resolved
.swiftpm/
.vscode/