From 948fe6c4885ef0484237729c28d8df620da83ae4 Mon Sep 17 00:00:00 2001 From: Guoye Zhang Date: Mon, 28 Oct 2024 17:33:58 -0700 Subject: [PATCH] Add sending --- Sources/HTTPTypes/HTTPFields.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Sources/HTTPTypes/HTTPFields.swift b/Sources/HTTPTypes/HTTPFields.swift index df8a141..c368dc9 100644 --- a/Sources/HTTPTypes/HTTPFields.swift +++ b/Sources/HTTPTypes/HTTPFields.swift @@ -32,7 +32,7 @@ public struct HTTPFields: Sendable, Hashable { required init() { } - func withLock(_ body: () throws -> Result) rethrows -> Result { + func withLock(_ body: () throws -> sending Result) rethrows -> sending Result { fatalError() } @@ -114,7 +114,7 @@ public struct HTTPFields: Sendable, Hashable { private final class _StorageWithMutex: _Storage, @unchecked Sendable { let mutex = Mutex(()) - override func withLock(_ body: () throws -> Result) rethrows -> Result { + override func withLock(_ body: () throws -> sending Result) rethrows -> sending Result { try self.mutex.withLock { _ in try body() } @@ -125,7 +125,7 @@ public struct HTTPFields: Sendable, Hashable { private final class _StorageWithNIOLock: _Storage, @unchecked Sendable { let lock = LockStorage.create(value: ()) - override func withLock(_ body: () throws -> Result) rethrows -> Result { + override func withLock(_ body: () throws -> sending Result) rethrows -> sending Result { try self.lock.withLockedValue { _ in try body() }