Skip to content

Commit 87ee9ae

Browse files
committed
change from struct to enum + fix formatting
1 parent 2cd67a3 commit 87ee9ae

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

Proposals/0023-progress-manager.md

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public func makeSalad() async {
121121
public func chopFruits() async -> Progress {}
122122
```
123123

124-
We are forced to await the `chopFruits()` call before receiving the `Progress` instance. However, the `Progress` instance that is returned from `chopFruits` already has its `completedUnitCount` equal to `totalUnitCount`. Since the `chopSubprogress` would have been completed before being added as a child to its parent `Progress`, it fails to show incremental progress as the code runs to completion within the method.
124+
We are forced to await the `chopFruits()` call before receiving the `Progress` instance. However, the `Progress` instance that is returned from `chopFruits` already has its `completedUnitCount` equal to `totalUnitCount`. Since the `chopSubprogress` would have been completed before being added as a child to its parent `Progress`, it fails to show incremental progress as the code runs to completion within the method.
125125

126126
While it may be possible to use the existing `Progress` to report progress in an `async` function to show incremental progress, by passing `Progress` as an argument to the function reporting progress, it is more error-prone, as shown below:
127127

@@ -701,12 +701,12 @@ If you would like to report additional metadata or properties that are not part
701701
@available(FoundationPreview 6.3, *)
702702
extension ProgressManager {
703703

704-
public struct Properties {
704+
public enum Properties {
705705

706706
/// The total number of files.
707707
public var totalFileCount: TotalFileCount.Type { get }
708708

709-
public struct TotalFileCount : Sendable, Property {
709+
public enum TotalFileCount : Sendable, Property {
710710

711711
public typealias Value = Int
712712

@@ -728,7 +728,7 @@ extension ProgressManager {
728728
/// The number of completed files.
729729
public var completedFileCount: CompletedFileCount.Type { get }
730730

731-
public struct CompletedFileCount : Sendable, Property {
731+
public enum CompletedFileCount : Sendable, Property {
732732

733733
public typealias Value = Int
734734

@@ -750,7 +750,7 @@ extension ProgressManager {
750750
/// The total number of bytes.
751751
public var totalByteCount: TotalByteCount.Type { get }
752752

753-
public struct TotalByteCount : Sendable, Property {
753+
public enum TotalByteCount : Sendable, Property {
754754

755755
public typealias Value = UInt64
756756

@@ -772,7 +772,7 @@ extension ProgressManager {
772772
/// The number of completed bytes.
773773
public var completedByteCount: CompletedByteCount.Type { get }
774774

775-
public struct CompletedByteCount : Sendable, Property {
775+
public enum CompletedByteCount : Sendable, Property {
776776

777777
public typealias Value = UInt64
778778

@@ -794,7 +794,7 @@ extension ProgressManager {
794794
/// The throughput, in bytes per second.
795795
public var throughput: Throughput.Type { get }
796796

797-
public struct Throughput : Sendable, Property {
797+
public enum Throughput : Sendable, Property {
798798

799799
public typealias Value = UInt64
800800

@@ -813,10 +813,10 @@ extension ProgressManager {
813813
public static func finalSummary(_ parentSummary: [UInt64], _ selfSummary: [UInt64]) -> [UInt64]
814814
}
815815

816-
/// The amount of time remaining in the processing of files.
816+
/// The amount of time remaining in operation.
817817
public var estimatedTimeRemaining: EstimatedTimeRemaining.Type { get }
818818

819-
public struct EstimatedTimeRemaining : Sendable, Property {
819+
public enum EstimatedTimeRemaining : Sendable, Property {
820820

821821
public typealias Value = Duration
822822

@@ -901,7 +901,7 @@ extension ProgressManager {
901901
///
902902
/// - Parameter key: A key path to the custom duration property type.
903903
public subscript<P: Property>(dynamicMember key: KeyPath<ProgressManager.Properties, P.Type>) -> Duration where P.Value == Duration, P.Summary == Duration { get set }
904-
904+
905905
/// Gets or sets custom double properties.
906906
///
907907
/// This subscript provides read-write access to custom progress properties where both the value
@@ -977,7 +977,7 @@ extension ProgressManager {
977977
/// where both the value and summary types are `Duration`.
978978
/// - Returns: An `Duration` summary value for the specified property.
979979
public func summary<P: Property>(of property: P.Type) -> P.Summary where P.Value == Duration, P.Summary == Duration
980-
980+
981981
/// Returns a summary for a custom double property across the progress subtree.
982982
///
983983
/// This method aggregates the values of a custom double property from this progress manager
@@ -1025,7 +1025,6 @@ extension ProgressManager {
10251025
public var totalCount: Int? { get }
10261026

10271027
/// The completed units of work.
1028-
/// If `self` is indeterminate, the value will be 0.
10291028
public var completedCount: Int { get }
10301029

10311030
/// The proportion of work completed.

0 commit comments

Comments
 (0)