diff --git a/Sources/SpellbookFoundation/DictionaryParsing/DictionaryCodingKey.swift b/Sources/SpellbookFoundation/DictionaryParsing/DictionaryCodingKey.swift index 8c24061..b764a0f 100644 --- a/Sources/SpellbookFoundation/DictionaryParsing/DictionaryCodingKey.swift +++ b/Sources/SpellbookFoundation/DictionaryParsing/DictionaryCodingKey.swift @@ -27,36 +27,9 @@ public enum DictionaryCodingKey { case index(Int) } -extension DictionaryCodingKey: CodingKey { - public init(stringValue: String) { - self = .key(stringValue) - } - - public var stringValue: String { - switch self { - case .key(let key): - return "\(key)" - case .index(let index): - return "\(index)" - } - } - - public init(intValue: Int) { - self = .index(intValue) - } - - public var intValue: Int? { - if case .index(let index) = self { - return index - } else { - return nil - } - } -} - extension DictionaryCodingKey: ExpressibleByStringLiteral { public init(stringLiteral value: StringLiteralType) { - self.init(stringValue: value) + self = .key(String(value)) } } diff --git a/Sources/SpellbookFoundation/Low Level/AuditToken.swift b/Sources/SpellbookFoundation/Low Level/AuditToken.swift index 1e1d957..1d1e6a8 100644 --- a/Sources/SpellbookFoundation/Low Level/AuditToken.swift +++ b/Sources/SpellbookFoundation/Low Level/AuditToken.swift @@ -62,7 +62,7 @@ extension audit_token_t { public var pidversion: Int32 { audit_token_to_pidversion(self) } } -extension audit_token_t: SafePOD, UnsafePOD {} +extension audit_token_t: SpellbookFoundation.SafePOD, SpellbookFoundation.UnsafePOD {} extension NSXPCConnection { public var auditToken: audit_token_t { diff --git a/Sources/SpellbookFoundation/Low Level/POD+Swift.swift b/Sources/SpellbookFoundation/Low Level/POD+Swift.swift index fe23fee..3940bdb 100644 --- a/Sources/SpellbookFoundation/Low Level/POD+Swift.swift +++ b/Sources/SpellbookFoundation/Low Level/POD+Swift.swift @@ -79,19 +79,19 @@ public protocol UnsafePOD: PODUnsafeHashable {} // MARK: - Oftenly used POD types -extension timespec: SafePOD, UnsafePOD {} -extension fsid_t: SafePOD, UnsafePOD {} -extension attrlist: SafePOD, UnsafePOD {} -extension attribute_set: SafePOD, UnsafePOD {} -extension attrreference: SafePOD, UnsafePOD {} -extension diskextent: SafePOD, UnsafePOD {} +extension timespec: SpellbookFoundation.SafePOD, SpellbookFoundation.UnsafePOD {} +extension fsid_t: SpellbookFoundation.SafePOD, SpellbookFoundation.UnsafePOD {} +extension attrlist: SpellbookFoundation.SafePOD, SpellbookFoundation.UnsafePOD {} +extension attribute_set: SpellbookFoundation.SafePOD, SpellbookFoundation.UnsafePOD {} +extension attrreference: SpellbookFoundation.SafePOD, SpellbookFoundation.UnsafePOD {} +extension diskextent: SpellbookFoundation.SafePOD, SpellbookFoundation.UnsafePOD {} -extension stat: SafePOD {} -extension statfs: SafePOD {} +extension stat: SpellbookFoundation.SafePOD {} +extension statfs: SpellbookFoundation.SafePOD {} -extension timeval: SafePOD {} +extension timeval: SpellbookFoundation.SafePOD {} -extension stat: Hashable { +extension stat: @retroactive Hashable { public static func == (lhs: Self, rhs: Self) -> Bool { lhs.st_dev == rhs.st_dev && lhs.st_mode == rhs.st_mode && @@ -135,7 +135,7 @@ extension stat: Hashable { } } -extension statfs: Hashable { +extension statfs: @retroactive Hashable { public static func == (lhs: Self, rhs: Self) -> Bool { lhs.f_bsize == rhs.f_bsize && lhs.f_iosize == rhs.f_iosize && @@ -175,7 +175,7 @@ extension statfs: Hashable { } } -extension timeval: Hashable { +extension timeval: @retroactive Hashable { public static func == (lhs: Self, rhs: Self) -> Bool { lhs.tv_sec == rhs.tv_sec && lhs.tv_usec == rhs.tv_usec diff --git a/Sources/SpellbookFoundation/Threading & Concurrency/ConcurrentBlockOperation.swift b/Sources/SpellbookFoundation/Threading & Concurrency/ConcurrentBlockOperation.swift index 7fa0179..8e86111 100644 --- a/Sources/SpellbookFoundation/Threading & Concurrency/ConcurrentBlockOperation.swift +++ b/Sources/SpellbookFoundation/Threading & Concurrency/ConcurrentBlockOperation.swift @@ -22,7 +22,7 @@ import Foundation -public final class ConcurrentBlockOperation: Operation { +public final class ConcurrentBlockOperation: Operation, @unchecked Sendable { @Atomic private var state: Bool? private let block: (ValueView, @escaping () -> Void) -> Void diff --git a/Sources/SpellbookFoundation/ValueObserving/EventAsk.swift b/Sources/SpellbookFoundation/ValueObserving/EventAsk.swift index 600309e..6a39134 100644 --- a/Sources/SpellbookFoundation/ValueObserving/EventAsk.swift +++ b/Sources/SpellbookFoundation/ValueObserving/EventAsk.swift @@ -58,8 +58,8 @@ public class EventAskEx { } public func ask(_ value: Input, timeout: Timeout? = nil) async -> Output { - await withCheckedContinuation { - askAsync(value, timeout: timeout, completion: $0.resume(returning:)) + await withCheckedContinuation { continuation in + askAsync(value, timeout: timeout) { continuation.resume(returning: $0) } } } diff --git a/Tests/SpellbookTests/Threading & Concurrency/PosixLocksTests.swift b/Tests/SpellbookTests/Threading & Concurrency/PosixLocksTests.swift deleted file mode 100644 index 098be8e..0000000 --- a/Tests/SpellbookTests/Threading & Concurrency/PosixLocksTests.swift +++ /dev/null @@ -1,26 +0,0 @@ -import SpellbookFoundation -import SpellbookTestUtils - -import Foundation -import XCTest - -class ExtensionsLocksTests: XCTestCase { - func test_os_unfair_lock() throws { - let lock = UnfairLock() - let count = 1000 - let expFinished = expectation(description: "finished") - expFinished.expectedFulfillmentCount = count - var sum = 0 - for i in 0.. { extension Dummy { func asyncValue() async -> T { await withCheckedContinuation { continuation in - value(reply: continuation.resume(returning:)) + value { continuation.resume(returning: $0) } } }