@@ -118,6 +118,8 @@ internal struct AnyMetatypeWrapper: Hashable, Equatable, Sendable {
118
118
}
119
119
}
120
120
121
+
122
+ /// A `ProgressReporter` instance, used for providing read-only observation of progress updates or composing into other `ProgressManager`s.
121
123
public var reporter : ProgressReporter {
122
124
return . init( manager: self )
123
125
}
@@ -127,6 +129,7 @@ internal struct AnyMetatypeWrapper: Hashable, Equatable, Sendable {
127
129
128
130
associatedtype Value : Sendable , Hashable, Equatable
129
131
132
+ /// The default value to return when property is not set to a specific value.
130
133
static var defaultValue : Value { get }
131
134
}
132
135
@@ -252,6 +255,9 @@ internal struct AnyMetatypeWrapper: Hashable, Equatable, Sendable {
252
255
253
256
/// Returns a `Subprogress` representing a portion of `self` which can be passed to any method that reports progress.
254
257
///
258
+ /// If the `Subprogress` is not converted into a `ProgressManager` (for example, due to an error or early return),
259
+ /// then the assigned count is marked as completed in the parent `ProgressManager`.
260
+ ///
255
261
/// - Parameter count: Units, which is a portion of `totalCount`delegated to an instance of `Subprogress`.
256
262
/// - Returns: A `Subprogress` instance.
257
263
public func subprogress( assigningCount portionOfParent: Int ) -> Subprogress {
@@ -264,16 +270,16 @@ internal struct AnyMetatypeWrapper: Hashable, Equatable, Sendable {
264
270
/// Adds a `ProgressReporter` as a child, with its progress representing a portion of `self`'s progress.
265
271
/// - Parameters:
266
272
/// - reporter: A `ProgressReporter` instance.
267
- /// - portionOfParent : Units, which is a portion of `totalCount`delegated to an instance of `Subprogress`.
268
- public func assign( count portionOfParent : Int , to reporter: ProgressReporter ) {
273
+ /// - count : Units, which is a portion of `totalCount`delegated to an instance of `Subprogress`.
274
+ public func assign( count: Int , to reporter: ProgressReporter ) {
269
275
precondition ( isCycle ( reporter: reporter) == false , " Creating a cycle is not allowed. " )
270
276
271
277
// get the actual progress from within the reporter, then add as children
272
278
let actualManager = reporter. manager
273
279
274
280
// Add reporter as child + Add self as parent
275
281
self . addToChildren ( childManager: actualManager)
276
- actualManager. addParent ( parentReporter: self , portionOfParent: portionOfParent )
282
+ actualManager. addParent ( parentReporter: self , portionOfParent: count )
277
283
}
278
284
279
285
/// Increases `completedCount` by `count`.
0 commit comments