Update stdlib/public/Distributed/DistributedActorSystem.swift

Co-authored-by: Kavon Farvardin <kfarvardin@apple.com>
This commit is contained in:
Konrad `ktoso` Malawski
2022-10-13 06:14:32 +09:00
committed by GitHub
parent 20e1834627
commit e1527ff9b6

View File

@@ -851,16 +851,16 @@ public struct RemoteCallArgument<Value> {
/// ```
///
/// ### Decoding DistributedActor arguments using Codable
/// When using the actor system's ``ActorID`` is ``Codable``, every distributed actor using that system
/// When using an actor system where ``ActorID`` is ``Codable``, every distributed actor using that system
/// is also implicitly ``Codable`` (see ``DistributedActorSystem``). Such distributed actors are encoded
/// as their ``ActorID`` stored in a ``Encoder/singleValueContainer``. Since ``Codable`` is being used
/// by this such system, it means that the ``decodeNextArgument`` method will be using ``Decoder`` to
/// decode the incoming values, some of which may be distributed actors.
/// as their ``ActorID`` stored in an ``Encoder/singleValueContainer``. When ``Codable`` is being used
/// by such a system, the ``decodeNextArgument`` method will be using ``Decoder`` to
/// decode the incoming values, which may themselves be distributed actors.
///
/// In order for a distributed actor's ``Decodable/init(from:)`` to be able to return an existing instance,
/// i.e. when the being-decoded ``ActorID`` actually references a locally hosted distributed actor, that the
/// current actor system can return from `resolve(id:as:)`, an actor system must be provided to the ``Decoder``.
/// This is done by setting the actor system the decoding is performed for, on the decoder's `userInfo`, as follows:
/// An actor system must be provided to the ``Decoder`` in order for a distributed actor's ``Decodable/init(from:)``
/// to be able to return the instance of the actor. Specifically, the decoded``ActorID`` is passed to the actor system's `resolve(id:as:)` method in order to
/// return either a local instance identified by this ID, or creating a remote actor reference.
/// Thus, you must set the actor system the decoding is performed for, on the decoder's `userInfo`, as follows:
///
/// ```
/// mutating func decodeNextArgument<Argument: SerializationRequirement>() throws -> Argument {
@@ -869,7 +869,7 @@ public struct RemoteCallArgument<Value> {
/// decoder.userInfo[.actorSystemKey] = self.actorSystem
/// return try Argument.decode(
/// }
// ```
/// ```
@available(SwiftStdlib 5.7, *)
public protocol DistributedTargetInvocationDecoder {
/// The serialization requirement that the types passed to `decodeNextArgument` are required to conform to.