Skip to content

Commit eed5bd1

Browse files
committed
[stdlib][Distributed] Add primary associated types for distributed actor protocols
1 parent 063c845 commit eed5bd1

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

stdlib/public/Distributed/DistributedActor.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ import _Concurrency
4141
/// Use the `CodingUserInfoKey.actorSystemKey` to provide the necessary
4242
/// actor system for the decoding initializer when decoding a distributed actor.
4343
@available(SwiftStdlib 5.7, *)
44-
public protocol DistributedActor: AnyActor, Identifiable, Hashable
44+
public protocol DistributedActor<ActorSystem>: AnyActor, Identifiable, Hashable
4545
where ID == ActorSystem.ActorID,
4646
SerializationRequirement == ActorSystem.SerializationRequirement {
4747

stdlib/public/Distributed/DistributedActorSystem.swift

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import _Concurrency
1919
/// `typealias DefaultDistributedActorSystem` declared which then applies to all distributed
2020
/// actors that do not declare a specific type alias in their bodies.
2121
@available(SwiftStdlib 5.7, *)
22-
public protocol DistributedActorSystem: Sendable {
22+
public protocol DistributedActorSystem<SerializationRequirement>: Sendable {
2323
/// The identity used by actors that communicate via this transport
2424
associatedtype ActorID: Sendable & Hashable
2525

@@ -450,7 +450,7 @@ func _executeDistributedTarget<D: DistributedTargetInvocationDecoder>(
450450
/// so decoding can rely on simply invoking e.g. `Codable` (if that is the `SerializationRequirement`) decoding
451451
/// entry points on the provided types.
452452
@available(SwiftStdlib 5.7, *)
453-
public protocol DistributedTargetInvocationEncoder {
453+
public protocol DistributedTargetInvocationEncoder<SerializationRequirement> {
454454
associatedtype SerializationRequirement
455455

456456
/// The arguments must be encoded order-preserving, and once `decodeGenericSubstitutions`
@@ -523,7 +523,7 @@ public struct RemoteCallArgument<Value> {
523523
/// Decoder that must be provided to `executeDistributedTarget` and is used
524524
/// by the Swift runtime to decode arguments of the invocation.
525525
@available(SwiftStdlib 5.7, *)
526-
public protocol DistributedTargetInvocationDecoder {
526+
public protocol DistributedTargetInvocationDecoder<SerializationRequirement> {
527527
associatedtype SerializationRequirement
528528

529529
mutating func decodeGenericSubstitutions() throws -> [Any.Type]
@@ -553,7 +553,9 @@ public protocol DistributedTargetInvocationDecoder {
553553
}
554554

555555
@available(SwiftStdlib 5.7, *)
556-
public protocol DistributedTargetInvocationResultHandler {
556+
public protocol DistributedTargetInvocationResultHandler<
557+
SerializationRequirement
558+
> {
557559
associatedtype SerializationRequirement
558560
// func onReturn<Success: SerializationRequirement>(value: Success) async throws
559561

0 commit comments

Comments
 (0)