You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Sources/SwiftDocC/Utility/Collection+ConcurrentPerform.swift
+88Lines changed: 88 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -144,3 +144,91 @@ extension Collection where Index == Int, Self: SendableMetatype {
144
144
return allResults.sync({ $0 })
145
145
}
146
146
}
147
+
148
+
extensionCollection{
149
+
/// Concurrently performs work on slices of the collection's elements, combining the partial results into a final result.
150
+
///
151
+
/// This method is intended as a building block that other higher-level `concurrent...` methods can be built upon.
152
+
/// That said, calling code can opt to use this method directly as opposed to writing overly specific single-use helper methods.
153
+
///
154
+
/// - Parameters:
155
+
/// - taskName: A human readable name of the tasks that the collection uses to perform this work.
156
+
/// - batchWork: The concurrent work to perform on each slice of the collection's elements.
157
+
/// - initialResult: The initial result to accumulate the partial results into.
158
+
/// - combineResults: A closure that updates the accumulated result with a partial result from performing the work over one slice of the collection's elements.
159
+
/// - Returns: The final result of accumulating all partial results, out of order, into the initial result.
0 commit comments