【发布时间】:2021-10-16 14:43:06
【问题描述】:
鉴于 UUID 类型是一个结构,我认为它应该是 Sendable。但是编译器会产生一个警告:
struct S: Sendable {
var int: Int
var id: UUID // <-- Stored property 'id' of 'Sendable'-conforming struct 'S' has non-sendable type 'UUID'
}
【问题讨论】:
-
struct 不会自动符合可发送。也许 UUID 对 C code 的引用用于生成唯一标识符是阻止它符合可发送的原因