mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Distributed] fix all distributed runtime tests; they are currently not running on CI (#38502)
This commit is contained in:
committed by
GitHub
parent
5c22dd51c1
commit
620a541b0f
@@ -126,13 +126,16 @@ extension DistributedActor {
|
||||
public protocol ActorIdentity: Sendable, Hashable, Codable {}
|
||||
|
||||
@available(SwiftStdlib 5.5, *)
|
||||
public struct AnyActorIdentity: ActorIdentity, @unchecked Sendable {
|
||||
public struct AnyActorIdentity: ActorIdentity, @unchecked Sendable, CustomStringConvertible {
|
||||
@usableFromInline let _hashInto: (inout Hasher) -> ()
|
||||
@usableFromInline let _equalTo: (Any) -> Bool
|
||||
@usableFromInline let _encodeTo: (Encoder) throws -> ()
|
||||
@usableFromInline let _description: () -> String
|
||||
|
||||
public init<ID>(_ identity: ID) where ID: ActorIdentity {
|
||||
_hashInto = { hasher in identity.hash(into: &hasher) }
|
||||
_hashInto = { hasher in identity
|
||||
.hash(into: &hasher)
|
||||
}
|
||||
_equalTo = { other in
|
||||
guard let rhs = other as? ID else {
|
||||
return false
|
||||
@@ -142,6 +145,9 @@ public struct AnyActorIdentity: ActorIdentity, @unchecked Sendable {
|
||||
_encodeTo = { encoder in
|
||||
try identity.encode(to: encoder)
|
||||
}
|
||||
_description = { () in
|
||||
"\(identity)"
|
||||
}
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
@@ -158,6 +164,10 @@ public struct AnyActorIdentity: ActorIdentity, @unchecked Sendable {
|
||||
try _encodeTo(encoder)
|
||||
}
|
||||
|
||||
public var description: String {
|
||||
"\(Self.self)(\(self._description()))"
|
||||
}
|
||||
|
||||
public func hash(into hasher: inout Hasher) {
|
||||
_hashInto(&hasher)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user