Continue documenting public surface (#25)

Signed-off-by: Danny Canter <danny_canter@apple.com>
This commit is contained in:
Danny Canter
2025-06-06 10:34:19 -04:00
committed by GitHub
parent 46260fd6a6
commit fc4a124173
32 changed files with 215 additions and 33 deletions
@@ -32,6 +32,7 @@ public protocol AddressAllocator<AddressType>: Sendable {
func disableAllocator() -> Bool
}
/// Errors that a type implementing AddressAllocator should throw.
public enum AllocatorError: Swift.Error, CustomStringConvertible, Equatable {
case allocatorDisabled
case allocatorFull
@@ -31,6 +31,7 @@ public actor AsyncLock {
public init() {}
/// withLock provides a scoped locking API to run a function while holding the lock.
public func withLock<T: Sendable>(_ body: @Sendable @escaping (Context) async throws -> T) async rethrows -> T {
while self.busy {
await withCheckedContinuation { cc in
@@ -18,6 +18,7 @@
import Foundation
extension FileManager {
/// Returns a unique temporary directory to use.
public func uniqueTemporaryDirectory(create: Bool = true) -> URL {
let tempDirectoryURL = temporaryDirectory
let uniqueDirectoryURL = tempDirectoryURL.appendingPathComponent(UUID().uuidString)
@@ -96,6 +96,7 @@ extension UInt32 {
extension Character {
private static let deviceLetters = Array("abcdefghijklmnopqrstuvwxyz")
/// Creates an allocator for block device tags, or any character values.
public static func blockDeviceTagAllocator() -> any AddressAllocator<Character> {
IndexedAddressAllocator(
size: Self.deviceLetters.count,