In Adoption of ActorSendable by Standard Library Types, the following example is given:
extension Array : ActorSendable where Element : ActorSendable {
func unsafeSendToActor() -> Self { self }
}
Is this correct? Isn't reusing the complete array only safe when its elements have value semantic?
For ActorSendable
Types with a custom unsafeSendToActor()
implementation, we'd have to call that for every element, right?
extension Array : ValueSemantic where Element : ValueSemantic {}
extension Array : ActorSendable where Element : ActorSendable {
func unsafeSendToActor() -> Self { self.map { $0.unsafeSendToActor() } }
}