Skip to content

Commit 7b5e3a5

Browse files
committed
Apply formatting
1 parent 03b3f33 commit 7b5e3a5

File tree

98 files changed

+12087
-11440
lines changed

Some content is hidden

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

98 files changed

+12087
-11440
lines changed

Package.swift

Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -3,59 +3,59 @@
33
import PackageDescription
44

55
let package = Package(
6-
name: "swift-async-algorithms",
7-
platforms: [
8-
.macOS("10.15"),
9-
.iOS("13.0"),
10-
.tvOS("13.0"),
11-
.watchOS("6.0")
12-
],
13-
products: [
14-
.library(name: "AsyncAlgorithms", targets: ["AsyncAlgorithms"]),
15-
],
16-
targets: [
17-
.target(
18-
name: "AsyncAlgorithms",
19-
dependencies: [
20-
.product(name: "OrderedCollections", package: "swift-collections"),
21-
.product(name: "DequeModule", package: "swift-collections"),
22-
],
23-
swiftSettings: [
24-
.enableExperimentalFeature("StrictConcurrency=complete"),
25-
]
26-
),
27-
.target(
28-
name: "AsyncSequenceValidation",
29-
dependencies: ["_CAsyncSequenceValidationSupport", "AsyncAlgorithms"],
30-
swiftSettings: [
31-
.enableExperimentalFeature("StrictConcurrency=complete"),
32-
]
33-
),
34-
.systemLibrary(name: "_CAsyncSequenceValidationSupport"),
35-
.target(
36-
name: "AsyncAlgorithms_XCTest",
37-
dependencies: ["AsyncAlgorithms", "AsyncSequenceValidation"],
38-
swiftSettings: [
39-
.enableExperimentalFeature("StrictConcurrency=complete"),
40-
]
41-
),
42-
.testTarget(
43-
name: "AsyncAlgorithmsTests",
44-
dependencies: ["AsyncAlgorithms", "AsyncSequenceValidation", "AsyncAlgorithms_XCTest"],
45-
swiftSettings: [
46-
.enableExperimentalFeature("StrictConcurrency=complete"),
47-
]
48-
),
49-
]
6+
name: "swift-async-algorithms",
7+
platforms: [
8+
.macOS("10.15"),
9+
.iOS("13.0"),
10+
.tvOS("13.0"),
11+
.watchOS("6.0"),
12+
],
13+
products: [
14+
.library(name: "AsyncAlgorithms", targets: ["AsyncAlgorithms"])
15+
],
16+
targets: [
17+
.target(
18+
name: "AsyncAlgorithms",
19+
dependencies: [
20+
.product(name: "OrderedCollections", package: "swift-collections"),
21+
.product(name: "DequeModule", package: "swift-collections"),
22+
],
23+
swiftSettings: [
24+
.enableExperimentalFeature("StrictConcurrency=complete")
25+
]
26+
),
27+
.target(
28+
name: "AsyncSequenceValidation",
29+
dependencies: ["_CAsyncSequenceValidationSupport", "AsyncAlgorithms"],
30+
swiftSettings: [
31+
.enableExperimentalFeature("StrictConcurrency=complete")
32+
]
33+
),
34+
.systemLibrary(name: "_CAsyncSequenceValidationSupport"),
35+
.target(
36+
name: "AsyncAlgorithms_XCTest",
37+
dependencies: ["AsyncAlgorithms", "AsyncSequenceValidation"],
38+
swiftSettings: [
39+
.enableExperimentalFeature("StrictConcurrency=complete")
40+
]
41+
),
42+
.testTarget(
43+
name: "AsyncAlgorithmsTests",
44+
dependencies: ["AsyncAlgorithms", "AsyncSequenceValidation", "AsyncAlgorithms_XCTest"],
45+
swiftSettings: [
46+
.enableExperimentalFeature("StrictConcurrency=complete")
47+
]
48+
),
49+
]
5050
)
5151

5252
if Context.environment["SWIFTCI_USE_LOCAL_DEPS"] == nil {
53-
package.dependencies += [
54-
.package(url: "https://github.com/apple/swift-collections.git", from: "1.1.0"),
55-
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0"),
56-
]
53+
package.dependencies += [
54+
.package(url: "https://github.com/apple/swift-collections.git", from: "1.1.0"),
55+
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0"),
56+
]
5757
} else {
58-
package.dependencies += [
59-
.package(path: "../swift-collections"),
60-
]
58+
package.dependencies += [
59+
.package(path: "../swift-collections")
60+
]
6161
}

[email protected]

Lines changed: 36 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3,37 +3,40 @@
33
import PackageDescription
44

55
let package = Package(
6-
name: "swift-async-algorithms",
7-
platforms: [
8-
.macOS("10.15"),
9-
.iOS("13.0"),
10-
.tvOS("13.0"),
11-
.watchOS("6.0")
12-
],
13-
products: [
14-
.library(name: "AsyncAlgorithms", targets: ["AsyncAlgorithms"]),
15-
.library(name: "AsyncSequenceValidation", targets: ["AsyncSequenceValidation"]),
16-
.library(name: "_CAsyncSequenceValidationSupport", type: .static, targets: ["AsyncSequenceValidation"]),
17-
.library(name: "AsyncAlgorithms_XCTest", targets: ["AsyncAlgorithms_XCTest"]),
18-
],
19-
dependencies: [
20-
.package(url: "https://github.com/apple/swift-collections.git", from: "1.0.4"),
21-
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0"),
22-
],
23-
targets: [
24-
.target(
25-
name: "AsyncAlgorithms",
26-
dependencies: [.product(name: "Collections", package: "swift-collections")]
27-
),
28-
.target(
29-
name: "AsyncSequenceValidation",
30-
dependencies: ["_CAsyncSequenceValidationSupport", "AsyncAlgorithms"]),
31-
.systemLibrary(name: "_CAsyncSequenceValidationSupport"),
32-
.target(
33-
name: "AsyncAlgorithms_XCTest",
34-
dependencies: ["AsyncAlgorithms", "AsyncSequenceValidation"]),
35-
.testTarget(
36-
name: "AsyncAlgorithmsTests",
37-
dependencies: ["AsyncAlgorithms", "AsyncSequenceValidation", "AsyncAlgorithms_XCTest"]),
38-
]
6+
name: "swift-async-algorithms",
7+
platforms: [
8+
.macOS("10.15"),
9+
.iOS("13.0"),
10+
.tvOS("13.0"),
11+
.watchOS("6.0"),
12+
],
13+
products: [
14+
.library(name: "AsyncAlgorithms", targets: ["AsyncAlgorithms"]),
15+
.library(name: "AsyncSequenceValidation", targets: ["AsyncSequenceValidation"]),
16+
.library(name: "_CAsyncSequenceValidationSupport", type: .static, targets: ["AsyncSequenceValidation"]),
17+
.library(name: "AsyncAlgorithms_XCTest", targets: ["AsyncAlgorithms_XCTest"]),
18+
],
19+
dependencies: [
20+
.package(url: "https://github.com/apple/swift-collections.git", from: "1.0.4"),
21+
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0"),
22+
],
23+
targets: [
24+
.target(
25+
name: "AsyncAlgorithms",
26+
dependencies: [.product(name: "Collections", package: "swift-collections")]
27+
),
28+
.target(
29+
name: "AsyncSequenceValidation",
30+
dependencies: ["_CAsyncSequenceValidationSupport", "AsyncAlgorithms"]
31+
),
32+
.systemLibrary(name: "_CAsyncSequenceValidationSupport"),
33+
.target(
34+
name: "AsyncAlgorithms_XCTest",
35+
dependencies: ["AsyncAlgorithms", "AsyncSequenceValidation"]
36+
),
37+
.testTarget(
38+
name: "AsyncAlgorithmsTests",
39+
dependencies: ["AsyncAlgorithms", "AsyncSequenceValidation", "AsyncAlgorithms_XCTest"]
40+
),
41+
]
3942
)

Sources/AsyncAlgorithms/AsyncAdjacentPairsSequence.swift

Lines changed: 56 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -10,80 +10,80 @@
1010
//===----------------------------------------------------------------------===//
1111

1212
extension AsyncSequence {
13-
/// An `AsyncSequence` that iterates over the adjacent pairs of the original
14-
/// original `AsyncSequence`.
15-
///
16-
/// ```
17-
/// for await (first, second) in (1...5).async.adjacentPairs() {
18-
/// print("First: \(first), Second: \(second)")
19-
/// }
20-
///
21-
/// // First: 1, Second: 2
22-
/// // First: 2, Second: 3
23-
/// // First: 3, Second: 4
24-
/// // First: 4, Second: 5
25-
/// ```
26-
///
27-
/// - Returns: An `AsyncSequence` where the element is a tuple of two adjacent elements
28-
/// or the original `AsyncSequence`.
29-
@inlinable
30-
public func adjacentPairs() -> AsyncAdjacentPairsSequence<Self> {
31-
AsyncAdjacentPairsSequence(self)
32-
}
13+
/// An `AsyncSequence` that iterates over the adjacent pairs of the original
14+
/// original `AsyncSequence`.
15+
///
16+
/// ```
17+
/// for await (first, second) in (1...5).async.adjacentPairs() {
18+
/// print("First: \(first), Second: \(second)")
19+
/// }
20+
///
21+
/// // First: 1, Second: 2
22+
/// // First: 2, Second: 3
23+
/// // First: 3, Second: 4
24+
/// // First: 4, Second: 5
25+
/// ```
26+
///
27+
/// - Returns: An `AsyncSequence` where the element is a tuple of two adjacent elements
28+
/// or the original `AsyncSequence`.
29+
@inlinable
30+
public func adjacentPairs() -> AsyncAdjacentPairsSequence<Self> {
31+
AsyncAdjacentPairsSequence(self)
32+
}
3333
}
3434

3535
/// An `AsyncSequence` that iterates over the adjacent pairs of the original
3636
/// `AsyncSequence`.
3737
@frozen
3838
public struct AsyncAdjacentPairsSequence<Base: AsyncSequence>: AsyncSequence {
39-
public typealias Element = (Base.Element, Base.Element)
40-
41-
@usableFromInline
42-
let base: Base
43-
44-
@inlinable
45-
init(_ base: Base) {
46-
self.base = base
47-
}
48-
49-
/// The iterator for an `AsyncAdjacentPairsSequence` instance.
50-
@frozen
51-
public struct Iterator: AsyncIteratorProtocol {
5239
public typealias Element = (Base.Element, Base.Element)
5340

5441
@usableFromInline
55-
var base: Base.AsyncIterator
56-
57-
@usableFromInline
58-
internal var previousElement: Base.Element?
42+
let base: Base
5943

6044
@inlinable
61-
init(_ base: Base.AsyncIterator) {
62-
self.base = base
45+
init(_ base: Base) {
46+
self.base = base
6347
}
6448

65-
@inlinable
66-
public mutating func next() async rethrows -> (Base.Element, Base.Element)? {
67-
if previousElement == nil {
68-
previousElement = try await base.next()
69-
}
49+
/// The iterator for an `AsyncAdjacentPairsSequence` instance.
50+
@frozen
51+
public struct Iterator: AsyncIteratorProtocol {
52+
public typealias Element = (Base.Element, Base.Element)
53+
54+
@usableFromInline
55+
var base: Base.AsyncIterator
56+
57+
@usableFromInline
58+
internal var previousElement: Base.Element?
59+
60+
@inlinable
61+
init(_ base: Base.AsyncIterator) {
62+
self.base = base
63+
}
7064

71-
guard let previous = previousElement, let next = try await base.next() else {
72-
return nil
73-
}
65+
@inlinable
66+
public mutating func next() async rethrows -> (Base.Element, Base.Element)? {
67+
if previousElement == nil {
68+
previousElement = try await base.next()
69+
}
7470

75-
previousElement = next
76-
return (previous, next)
71+
guard let previous = previousElement, let next = try await base.next() else {
72+
return nil
73+
}
74+
75+
previousElement = next
76+
return (previous, next)
77+
}
7778
}
78-
}
7979

80-
@inlinable
81-
public func makeAsyncIterator() -> Iterator {
82-
Iterator(base.makeAsyncIterator())
83-
}
80+
@inlinable
81+
public func makeAsyncIterator() -> Iterator {
82+
Iterator(base.makeAsyncIterator())
83+
}
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 {}

0 commit comments

Comments
 (0)