aboutsummaryrefslogtreecommitdiff
path: root/DomainDig/LookupRuntime.swift
diff options
context:
space:
mode:
Diffstat (limited to 'DomainDig/LookupRuntime.swift')
-rw-r--r--DomainDig/LookupRuntime.swift10
1 files changed, 9 insertions, 1 deletions
diff --git a/DomainDig/LookupRuntime.swift b/DomainDig/LookupRuntime.swift
index 5db3134..7d9a8bd 100644
--- a/DomainDig/LookupRuntime.swift
+++ b/DomainDig/LookupRuntime.swift
@@ -1,10 +1,18 @@
import Foundation
-struct CachedLookupResult<Value> {
+/// Opted out of the project's MainActor default isolation: this is a plain
+/// value pair constructed inside `actor LookupRuntime`, and a MainActor-bound
+/// memberwise init cannot be called from there under Swift 6.
+nonisolated struct CachedLookupResult<Value> {
let value: Value
let source: LookupResultSource
}
+/// Opting out of MainActor isolation also opted out of the implicit
+/// Sendable that globally-isolated types get, which is what lets this cross
+/// from `actor LookupRuntime` back to its callers.
+extension CachedLookupResult: Sendable where Value: Sendable {}
+
actor LookupRuntime {
static let shared = LookupRuntime()