Skip to content

Commit d5b49aa

Browse files
committed
Apply formatting
1 parent ba33a22 commit d5b49aa

File tree

97 files changed

+5081
-4443
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+5081
-4443
lines changed

Package.swift

+9-9
Original file line numberDiff line numberDiff line change
@@ -8,42 +8,42 @@ let package = Package(
88
.macOS("10.15"),
99
.iOS("13.0"),
1010
.tvOS("13.0"),
11-
.watchOS("6.0")
11+
.watchOS("6.0"),
1212
],
1313
products: [
14-
.library(name: "AsyncAlgorithms", targets: ["AsyncAlgorithms"]),
14+
.library(name: "AsyncAlgorithms", targets: ["AsyncAlgorithms"])
1515
],
1616
targets: [
1717
.target(
1818
name: "AsyncAlgorithms",
1919
dependencies: [
20-
.product(name: "OrderedCollections", package: "swift-collections"),
21-
.product(name: "DequeModule", package: "swift-collections"),
20+
.product(name: "OrderedCollections", package: "swift-collections"),
21+
.product(name: "DequeModule", package: "swift-collections"),
2222
],
2323
swiftSettings: [
24-
.enableExperimentalFeature("StrictConcurrency=complete"),
24+
.enableExperimentalFeature("StrictConcurrency=complete")
2525
]
2626
),
2727
.target(
2828
name: "AsyncSequenceValidation",
2929
dependencies: ["_CAsyncSequenceValidationSupport", "AsyncAlgorithms"],
3030
swiftSettings: [
31-
.enableExperimentalFeature("StrictConcurrency=complete"),
31+
.enableExperimentalFeature("StrictConcurrency=complete")
3232
]
3333
),
3434
.systemLibrary(name: "_CAsyncSequenceValidationSupport"),
3535
.target(
3636
name: "AsyncAlgorithms_XCTest",
3737
dependencies: ["AsyncAlgorithms", "AsyncSequenceValidation"],
3838
swiftSettings: [
39-
.enableExperimentalFeature("StrictConcurrency=complete"),
39+
.enableExperimentalFeature("StrictConcurrency=complete")
4040
]
4141
),
4242
.testTarget(
4343
name: "AsyncAlgorithmsTests",
4444
dependencies: ["AsyncAlgorithms", "AsyncSequenceValidation", "AsyncAlgorithms_XCTest"],
4545
swiftSettings: [
46-
.enableExperimentalFeature("StrictConcurrency=complete"),
46+
.enableExperimentalFeature("StrictConcurrency=complete")
4747
]
4848
),
4949
]
@@ -56,6 +56,6 @@ if Context.environment["SWIFTCI_USE_LOCAL_DEPS"] == nil {
5656
]
5757
} else {
5858
package.dependencies += [
59-
.package(path: "../swift-collections"),
59+
.package(path: "../swift-collections")
6060
]
6161
}

[email protected]

+7-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ let package = Package(
88
.macOS("10.15"),
99
.iOS("13.0"),
1010
.tvOS("13.0"),
11-
.watchOS("6.0")
11+
.watchOS("6.0"),
1212
],
1313
products: [
1414
.library(name: "AsyncAlgorithms", targets: ["AsyncAlgorithms"]),
@@ -27,13 +27,16 @@ let package = Package(
2727
),
2828
.target(
2929
name: "AsyncSequenceValidation",
30-
dependencies: ["_CAsyncSequenceValidationSupport", "AsyncAlgorithms"]),
30+
dependencies: ["_CAsyncSequenceValidationSupport", "AsyncAlgorithms"]
31+
),
3132
.systemLibrary(name: "_CAsyncSequenceValidationSupport"),
3233
.target(
3334
name: "AsyncAlgorithms_XCTest",
34-
dependencies: ["AsyncAlgorithms", "AsyncSequenceValidation"]),
35+
dependencies: ["AsyncAlgorithms", "AsyncSequenceValidation"]
36+
),
3537
.testTarget(
3638
name: "AsyncAlgorithmsTests",
37-
dependencies: ["AsyncAlgorithms", "AsyncSequenceValidation", "AsyncAlgorithms_XCTest"]),
39+
dependencies: ["AsyncAlgorithms", "AsyncSequenceValidation", "AsyncAlgorithms_XCTest"]
40+
),
3841
]
3942
)

Sources/AsyncAlgorithms/AsyncAdjacentPairsSequence.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public struct AsyncAdjacentPairsSequence<Base: AsyncSequence>: AsyncSequence {
8383
}
8484
}
8585

86-
extension AsyncAdjacentPairsSequence: Sendable where Base: Sendable, Base.Element: Sendable { }
86+
extension AsyncAdjacentPairsSequence: Sendable where Base: Sendable, Base.Element: Sendable {}
8787

8888
@available(*, unavailable)
89-
extension AsyncAdjacentPairsSequence.Iterator: Sendable { }
89+
extension AsyncAdjacentPairsSequence.Iterator: Sendable {}

Sources/AsyncAlgorithms/AsyncBufferedByteIterator.swift

+10-10
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
public struct AsyncBufferedByteIterator: AsyncIteratorProtocol {
4343
public typealias Element = UInt8
4444
@usableFromInline var buffer: _AsyncBytesBuffer
45-
45+
4646
/// Creates an asynchronous buffered byte iterator with a specified capacity and read function.
4747
///
4848
/// - Parameters:
@@ -55,7 +55,7 @@ public struct AsyncBufferedByteIterator: AsyncIteratorProtocol {
5555
) {
5656
buffer = _AsyncBytesBuffer(capacity: capacity, readFunction: readFunction)
5757
}
58-
58+
5959
/// Reads a byte out of the buffer if available. When no bytes are available, this will trigger
6060
/// the read function to reload the buffer and then return the next byte from that buffer.
6161
@inlinable @inline(__always)
@@ -65,14 +65,14 @@ public struct AsyncBufferedByteIterator: AsyncIteratorProtocol {
6565
}
6666

6767
@available(*, unavailable)
68-
extension AsyncBufferedByteIterator: Sendable { }
68+
extension AsyncBufferedByteIterator: Sendable {}
6969

7070
@frozen @usableFromInline
7171
internal struct _AsyncBytesBuffer {
7272
@usableFromInline
7373
final class Storage {
7474
fileprivate let buffer: UnsafeMutableRawBufferPointer
75-
75+
7676
init(
7777
capacity: Int
7878
) {
@@ -82,19 +82,19 @@ internal struct _AsyncBytesBuffer {
8282
alignment: MemoryLayout<AnyObject>.alignment
8383
)
8484
}
85-
85+
8686
deinit {
8787
buffer.deallocate()
8888
}
8989
}
90-
90+
9191
@usableFromInline internal let storage: Storage
9292
@usableFromInline internal var nextPointer: UnsafeRawPointer
9393
@usableFromInline internal var endPointer: UnsafeRawPointer
94-
94+
9595
internal let readFunction: @Sendable (UnsafeMutableRawBufferPointer) async throws -> Int
9696
internal var finished = false
97-
97+
9898
@usableFromInline init(
9999
capacity: Int,
100100
readFunction: @Sendable @escaping (UnsafeMutableRawBufferPointer) async throws -> Int
@@ -105,7 +105,7 @@ internal struct _AsyncBytesBuffer {
105105
nextPointer = UnsafeRawPointer(s.buffer.baseAddress!)
106106
endPointer = nextPointer
107107
}
108-
108+
109109
@inline(never) @usableFromInline
110110
internal mutating func reloadBufferAndNext() async throws -> UInt8? {
111111
if finished {
@@ -128,7 +128,7 @@ internal struct _AsyncBytesBuffer {
128128
}
129129
return try await next()
130130
}
131-
131+
132132
@inlinable @inline(__always)
133133
internal mutating func next() async throws -> UInt8? {
134134
if _fastPath(nextPointer != endPointer) {

Sources/AsyncAlgorithms/AsyncChain2Sequence.swift

+13-10
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@
1818
/// - Returns: An asynchronous sequence that iterates first over the elements of `s1`, and
1919
/// then over the elements of `s2`.
2020
@inlinable
21-
public func chain<Base1: AsyncSequence, Base2: AsyncSequence>(_ s1: Base1, _ s2: Base2) -> AsyncChain2Sequence<Base1, Base2> where Base1.Element == Base2.Element {
21+
public func chain<Base1: AsyncSequence, Base2: AsyncSequence>(
22+
_ s1: Base1,
23+
_ s2: Base2
24+
) -> AsyncChain2Sequence<Base1, Base2> where Base1.Element == Base2.Element {
2225
AsyncChain2Sequence(s1, s2)
2326
}
2427

@@ -27,10 +30,10 @@ public func chain<Base1: AsyncSequence, Base2: AsyncSequence>(_ s1: Base1, _ s2:
2730
public struct AsyncChain2Sequence<Base1: AsyncSequence, Base2: AsyncSequence> where Base1.Element == Base2.Element {
2831
@usableFromInline
2932
let base1: Base1
30-
33+
3134
@usableFromInline
3235
let base2: Base2
33-
36+
3437
@usableFromInline
3538
init(_ base1: Base1, _ base2: Base2) {
3639
self.base1 = base1
@@ -40,22 +43,22 @@ public struct AsyncChain2Sequence<Base1: AsyncSequence, Base2: AsyncSequence> wh
4043

4144
extension AsyncChain2Sequence: AsyncSequence {
4245
public typealias Element = Base1.Element
43-
46+
4447
/// The iterator for a `AsyncChain2Sequence` instance.
4548
@frozen
4649
public struct Iterator: AsyncIteratorProtocol {
4750
@usableFromInline
4851
var base1: Base1.AsyncIterator?
49-
52+
5053
@usableFromInline
5154
var base2: Base2.AsyncIterator?
52-
55+
5356
@usableFromInline
5457
init(_ base1: Base1.AsyncIterator, _ base2: Base2.AsyncIterator) {
5558
self.base1 = base1
5659
self.base2 = base2
5760
}
58-
61+
5962
@inlinable
6063
public mutating func next() async rethrows -> Element? {
6164
do {
@@ -72,14 +75,14 @@ extension AsyncChain2Sequence: AsyncSequence {
7275
}
7376
}
7477
}
75-
78+
7679
@inlinable
7780
public func makeAsyncIterator() -> Iterator {
7881
Iterator(base1.makeAsyncIterator(), base2.makeAsyncIterator())
7982
}
8083
}
8184

82-
extension AsyncChain2Sequence: Sendable where Base1: Sendable, Base2: Sendable { }
85+
extension AsyncChain2Sequence: Sendable where Base1: Sendable, Base2: Sendable {}
8386

8487
@available(*, unavailable)
85-
extension AsyncChain2Sequence.Iterator: Sendable { }
88+
extension AsyncChain2Sequence.Iterator: Sendable {}

Sources/AsyncAlgorithms/AsyncChain3Sequence.swift

+18-13
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,27 @@
1919
/// - Returns: An asynchronous sequence that iterates first over the elements of `s1`, and
2020
/// then over the elements of `s2`, and then over the elements of `s3`
2121
@inlinable
22-
public func chain<Base1: AsyncSequence, Base2: AsyncSequence, Base3: AsyncSequence>(_ s1: Base1, _ s2: Base2, _ s3: Base3) -> AsyncChain3Sequence<Base1, Base2, Base3> {
22+
public func chain<Base1: AsyncSequence, Base2: AsyncSequence, Base3: AsyncSequence>(
23+
_ s1: Base1,
24+
_ s2: Base2,
25+
_ s3: Base3
26+
) -> AsyncChain3Sequence<Base1, Base2, Base3> {
2327
AsyncChain3Sequence(s1, s2, s3)
2428
}
2529

2630
/// A concatenation of three asynchronous sequences with the same element type.
2731
@frozen
28-
public struct AsyncChain3Sequence<Base1: AsyncSequence, Base2: AsyncSequence, Base3: AsyncSequence> where Base1.Element == Base2.Element, Base1.Element == Base3.Element {
32+
public struct AsyncChain3Sequence<Base1: AsyncSequence, Base2: AsyncSequence, Base3: AsyncSequence>
33+
where Base1.Element == Base2.Element, Base1.Element == Base3.Element {
2934
@usableFromInline
3035
let base1: Base1
31-
36+
3237
@usableFromInline
3338
let base2: Base2
34-
39+
3540
@usableFromInline
3641
let base3: Base3
37-
42+
3843
@usableFromInline
3944
init(_ base1: Base1, _ base2: Base2, _ base3: Base3) {
4045
self.base1 = base1
@@ -45,26 +50,26 @@ public struct AsyncChain3Sequence<Base1: AsyncSequence, Base2: AsyncSequence, Ba
4550

4651
extension AsyncChain3Sequence: AsyncSequence {
4752
public typealias Element = Base1.Element
48-
53+
4954
/// The iterator for a `AsyncChain3Sequence` instance.
5055
@frozen
5156
public struct Iterator: AsyncIteratorProtocol {
5257
@usableFromInline
5358
var base1: Base1.AsyncIterator?
54-
59+
5560
@usableFromInline
5661
var base2: Base2.AsyncIterator?
57-
62+
5863
@usableFromInline
5964
var base3: Base3.AsyncIterator?
60-
65+
6166
@usableFromInline
6267
init(_ base1: Base1.AsyncIterator, _ base2: Base2.AsyncIterator, _ base3: Base3.AsyncIterator) {
6368
self.base1 = base1
6469
self.base2 = base2
6570
self.base3 = base3
6671
}
67-
72+
6873
@inlinable
6974
public mutating func next() async rethrows -> Element? {
7075
do {
@@ -87,14 +92,14 @@ extension AsyncChain3Sequence: AsyncSequence {
8792
}
8893
}
8994
}
90-
95+
9196
@inlinable
9297
public func makeAsyncIterator() -> Iterator {
9398
Iterator(base1.makeAsyncIterator(), base2.makeAsyncIterator(), base3.makeAsyncIterator())
9499
}
95100
}
96101

97-
extension AsyncChain3Sequence: Sendable where Base1: Sendable, Base2: Sendable, Base3: Sendable { }
102+
extension AsyncChain3Sequence: Sendable where Base1: Sendable, Base2: Sendable, Base3: Sendable {}
98103

99104
@available(*, unavailable)
100-
extension AsyncChain3Sequence.Iterator: Sendable { }
105+
extension AsyncChain3Sequence.Iterator: Sendable {}

0 commit comments

Comments
 (0)