This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import OSLog | |
import class Foundation.Bundle | |
import class Foundation.ProcessInfo | |
import struct Foundation.TimeZone | |
/// Diagnostics allows debugging and gathering usage data. | |
public enum Diagnostics { | |
/// Info including application name and version. | |
public static let info: String = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension Optional | |
where Wrapped == Task<Void, Never> { | |
public mutating func clearIfCurrent() { | |
switch self { | |
case .some(let task) where task.isCurrent: | |
self = .none | |
case _: | |
break // noop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
extension JSONEncoder { | |
public func encode( | |
any anyEncodable: any Encodable | |
) throws -> Data { | |
try self.encode( | |
JSONEncodingWrapper(encodable: anyEncodable) | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import libkern | |
@usableFromInline | |
internal final class AsyncSpinLock { | |
@TaskLocal private static var taskContext: Array<AsyncSpinLock> = .init() | |
@usableFromInline | |
internal let atomicFlagPointer: UnsafeMutablePointer<atomic_flag> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Combine | |
extension Publisher { | |
public func asAsyncThrowingSequence() -> StreamedAsyncThrowingSequence<Output> { | |
StreamedAsyncThrowingSequence(self) | |
} | |
} | |
extension Publisher where Failure == Never { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import struct Foundation.UUID | |
import os | |
import libkern | |
public enum MemoryLeaks { | |
public static func listActiveMarkers() -> Array<Marker> { | |
let markersRegistryCopy: Dictionary<AnyHashable, WeakMarker> = markersRegistryLock | |
.withLock { Self.markersRegistry } | |
return markersRegistryCopy.values.compactMap(\.marker) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public struct Tagged<RawValue, Type>: RawRepresentable { | |
public var rawValue: RawValue | |
public init( | |
rawValue: RawValue | |
) { | |
self.rawValue = rawValue | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import SQLite3 | |
private final class SQLiteHandle { | |
fileprivate var handle: OpaquePointer? | |
fileprivate init(handle: OpaquePointer?) { | |
self.handle = handle | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Atomics | |
public final class Future<Value> { | |
private let fulfillmentStatus: ManagedAtomic<Bool> | |
private let valueStatus: ManagedAtomic<Bool> | |
private let handlingStatus: ManagedAtomic<Bool> | |
private let handlerStatus: ManagedAtomic<Bool> | |
private let completionStatus: ManagedAtomic<Bool> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import struct Foundation.TimeInterval | |
import struct Foundation.Date | |
import class Atomics.ManagedAtomic | |
/// Cancelation token that can be used to cancel associated tasks. | |
public struct Cancelation { | |
private var status: () -> Bool | |
private var cancelation: () -> Void | |
} |
NewerOlder