feat: Conforming types to Sendable
This commit is contained in:
@@ -46,7 +46,8 @@ let package = Package(
|
|||||||
.product(name: "ComposableArchitecture", package: "swift-composable-architecture"),
|
.product(name: "ComposableArchitecture", package: "swift-composable-architecture"),
|
||||||
.product(name: "DependenciesAdditions", package: "swift-dependencies-additions"),
|
.product(name: "DependenciesAdditions", package: "swift-dependencies-additions"),
|
||||||
.product(name: "TCAExtras", package: "swift-tca-extras")
|
.product(name: "TCAExtras", package: "swift-tca-extras")
|
||||||
]
|
],
|
||||||
|
swiftSettings: settings
|
||||||
),
|
),
|
||||||
.target(
|
.target(
|
||||||
name: "EstimatedPressureDependency",
|
name: "EstimatedPressureDependency",
|
||||||
@@ -61,15 +62,20 @@ let package = Package(
|
|||||||
dependencies: [
|
dependencies: [
|
||||||
"SharedModels",
|
"SharedModels",
|
||||||
"Styleguide"
|
"Styleguide"
|
||||||
]
|
],
|
||||||
|
swiftSettings: settings
|
||||||
|
),
|
||||||
|
.target(
|
||||||
|
name: "SharedModels",
|
||||||
|
swiftSettings: settings
|
||||||
),
|
),
|
||||||
.target(name: "SharedModels"),
|
|
||||||
.target(
|
.target(
|
||||||
name: "Styleguide",
|
name: "Styleguide",
|
||||||
dependencies: [
|
dependencies: [
|
||||||
"SharedModels",
|
"SharedModels",
|
||||||
.product(name: "ComposableArchitecture", package: "swift-composable-architecture"),
|
.product(name: "ComposableArchitecture", package: "swift-composable-architecture"),
|
||||||
]
|
],
|
||||||
|
swiftSettings: settings
|
||||||
),
|
),
|
||||||
.testTarget(
|
.testTarget(
|
||||||
name: "EstimatedPressureTests",
|
name: "EstimatedPressureTests",
|
||||||
@@ -89,7 +95,12 @@ let package = Package(
|
|||||||
.product(name: "DependenciesAdditions", package: "swift-dependencies-additions"),
|
.product(name: "DependenciesAdditions", package: "swift-dependencies-additions"),
|
||||||
.product(name: "TCAExtras", package: "swift-tca-extras")
|
.product(name: "TCAExtras", package: "swift-tca-extras")
|
||||||
|
|
||||||
]
|
],
|
||||||
|
swiftSettings: settings
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
let settings: [SwiftSetting] = [
|
||||||
|
.enableExperimentalFeature("StrictConcurrency")
|
||||||
|
]
|
||||||
|
|||||||
@@ -12,12 +12,12 @@ extension DependencyValues {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@DependencyClient
|
@DependencyClient
|
||||||
public struct EstimatedPressureDependency {
|
public struct EstimatedPressureDependency: Sendable {
|
||||||
|
|
||||||
public var estimatedAirflow: (EstimatedAirflowRequest) async throws -> Positive<Double>
|
public var estimatedAirflow: @Sendable (EstimatedAirflowRequest) async throws -> Positive<Double>
|
||||||
public var estimatedPressure: (EstimatedPressureRequest) async throws -> Positive<Double>
|
public var estimatedPressure: @Sendable (EstimatedPressureRequest) async throws -> Positive<Double>
|
||||||
|
|
||||||
public struct EstimatedPressureRequest: Equatable {
|
public struct EstimatedPressureRequest: Equatable, Sendable {
|
||||||
public let existingPressure: Positive<Double>
|
public let existingPressure: Positive<Double>
|
||||||
public let existingAirflow: Positive<Double>
|
public let existingAirflow: Positive<Double>
|
||||||
public let targetAirflow: Positive<Double>
|
public let targetAirflow: Positive<Double>
|
||||||
@@ -33,7 +33,7 @@ public struct EstimatedPressureDependency {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public struct EstimatedAirflowRequest: Equatable {
|
public struct EstimatedAirflowRequest: Equatable, Sendable {
|
||||||
public let existingAirflow: Positive<Double>
|
public let existingAirflow: Positive<Double>
|
||||||
public let existingPressure: Positive<Double>
|
public let existingPressure: Positive<Double>
|
||||||
public let targetPressure: Positive<Double>
|
public let targetPressure: Positive<Double>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public struct BudgetedPercentEnvelope: Equatable {
|
public struct BudgetedPercentEnvelope: Equatable, Sendable {
|
||||||
|
|
||||||
public var coilBudget: Percentage
|
public var coilBudget: Percentage
|
||||||
public var filterBudget: Percentage
|
public var filterBudget: Percentage
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public enum EquipmentMeasurement: Equatable {
|
public enum EquipmentMeasurement: Equatable, Sendable {
|
||||||
|
|
||||||
case airHandler(AirHandler)
|
case airHandler(AirHandler)
|
||||||
case furnaceAndCoil(FurnaceAndCoil)
|
case furnaceAndCoil(FurnaceAndCoil)
|
||||||
|
|
||||||
@@ -32,7 +32,7 @@ public enum EquipmentMeasurement: Equatable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public struct AirHandler: Equatable {
|
public struct AirHandler: Equatable, Sendable {
|
||||||
|
|
||||||
@Positive
|
@Positive
|
||||||
public var airflow: Double
|
public var airflow: Double
|
||||||
@@ -95,7 +95,7 @@ public enum EquipmentMeasurement: Equatable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum EquipmentType: Equatable, CaseIterable, CustomStringConvertible, Identifiable {
|
public enum EquipmentType: Equatable, CaseIterable, CustomStringConvertible, Identifiable, Sendable {
|
||||||
case airHandler
|
case airHandler
|
||||||
case furnaceAndCoil
|
case furnaceAndCoil
|
||||||
|
|
||||||
@@ -113,7 +113,7 @@ public enum EquipmentMeasurement: Equatable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Needs updated for when forms are using `minmal` values.
|
// TODO: Needs updated for when forms are using `minmal` values.
|
||||||
public struct FlaggedMeasurement: Equatable {
|
public struct FlaggedMeasurement: Equatable, Sendable {
|
||||||
public var airflow: Flagged
|
public var airflow: Flagged
|
||||||
public var coilPressureDrop: Flagged
|
public var coilPressureDrop: Flagged
|
||||||
public var externalStaticPressure: Flagged
|
public var externalStaticPressure: Flagged
|
||||||
@@ -234,7 +234,7 @@ public enum EquipmentMeasurement: Equatable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public struct FurnaceAndCoil: Equatable {
|
public struct FurnaceAndCoil: Equatable, Sendable {
|
||||||
|
|
||||||
@Positive
|
@Positive
|
||||||
public var airflow: Double
|
public var airflow: Double
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public struct EquipmentMetadata: Equatable {
|
public struct EquipmentMetadata: Equatable, Sendable {
|
||||||
public var coolingCapacity: CoolingCapacity
|
public var coolingCapacity: CoolingCapacity
|
||||||
public var fanType: FanType
|
public var fanType: FanType
|
||||||
public var ratedStaticPressures: RatedStaticPressures
|
public var ratedStaticPressures: RatedStaticPressures
|
||||||
@@ -15,7 +15,7 @@ public struct EquipmentMetadata: Equatable {
|
|||||||
self.ratedStaticPressures = ratedStaticPressures
|
self.ratedStaticPressures = ratedStaticPressures
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum CoolingCapacity: Double, Equatable, CaseIterable, Identifiable, CustomStringConvertible {
|
public enum CoolingCapacity: Double, Equatable, CaseIterable, Identifiable, CustomStringConvertible, Sendable {
|
||||||
case half = 0.5
|
case half = 0.5
|
||||||
case threeQuarter = 0.75
|
case threeQuarter = 0.75
|
||||||
case one = 1
|
case one = 1
|
||||||
@@ -57,7 +57,7 @@ public struct EquipmentMetadata: Equatable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum FanType: Hashable, Equatable, CaseIterable, CustomStringConvertible, Identifiable {
|
public enum FanType: Hashable, Equatable, CaseIterable, CustomStringConvertible, Identifiable, Sendable {
|
||||||
case constantSpeed
|
case constantSpeed
|
||||||
case variableSpeed
|
case variableSpeed
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import Foundation
|
|||||||
/// on the current value.
|
/// on the current value.
|
||||||
///
|
///
|
||||||
@dynamicMemberLookup
|
@dynamicMemberLookup
|
||||||
public struct Flagged: Equatable {
|
public struct Flagged: Equatable, Sendable {
|
||||||
|
|
||||||
public var checkValue: CheckHandler
|
public var checkValue: CheckHandler
|
||||||
public var wrappedValue: Double
|
public var wrappedValue: Double
|
||||||
|
|
||||||
@@ -51,11 +51,11 @@ public struct Flagged: Equatable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public struct CheckHandler {
|
public struct CheckHandler: Sendable {
|
||||||
|
|
||||||
let checkValue: (Double) -> CheckResult
|
let checkValue: @Sendable (Double) -> CheckResult
|
||||||
|
|
||||||
public init(_ checkValue: @escaping (Double) -> CheckResult) {
|
public init(_ checkValue: @escaping @Sendable (Double) -> CheckResult) {
|
||||||
self.checkValue = checkValue
|
self.checkValue = checkValue
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,8 +64,8 @@ public struct Flagged: Equatable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum CheckResult: Equatable {
|
public enum CheckResult: Equatable, Sendable {
|
||||||
|
|
||||||
case aboveMaximum(Double)
|
case aboveMaximum(Double)
|
||||||
case belowMinimum(Double)
|
case belowMinimum(Double)
|
||||||
case betweenRange(minimum: Double, maximum: Double)
|
case betweenRange(minimum: Double, maximum: Double)
|
||||||
@@ -113,7 +113,7 @@ public struct Flagged: Equatable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum Status: String, Equatable, CaseIterable {
|
public enum Status: String, Equatable, CaseIterable, Sendable {
|
||||||
case good, warning, error
|
case good, warning, error
|
||||||
|
|
||||||
public var title: String {
|
public var title: String {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public struct Percentage: Equatable, RawRepresentable {
|
public struct Percentage: Equatable, RawRepresentable, Sendable {
|
||||||
|
|
||||||
public var rawValue: Double
|
public var rawValue: Double
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ public struct Positive<Value> where Value: Numeric, Value: Comparable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
extension Positive: Equatable where Value: Equatable { }
|
extension Positive: Equatable where Value: Equatable { }
|
||||||
|
extension Positive: Sendable where Value: Sendable { }
|
||||||
|
|
||||||
extension Positive: Comparable where Value: Comparable {
|
extension Positive: Comparable where Value: Comparable {
|
||||||
public static func < (lhs: Positive<Value>, rhs: Positive<Value>) -> Bool {
|
public static func < (lhs: Positive<Value>, rhs: Positive<Value>) -> Bool {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public enum PlenumDimension: Equatable {
|
public enum PlenumDimension: Equatable, Sendable {
|
||||||
case rectangular(width: Double, height: Double)
|
case rectangular(width: Double, height: Double)
|
||||||
case round(Double)
|
case round(Double)
|
||||||
|
|
||||||
@@ -15,7 +15,7 @@ public enum PlenumDimension: Equatable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum Key: String, Equatable, CaseIterable, CustomStringConvertible {
|
public enum Key: String, Equatable, CaseIterable, CustomStringConvertible, Sendable {
|
||||||
|
|
||||||
case rectangular, round
|
case rectangular, round
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public struct RatedEnvelope<Rating>: Equatable {
|
public struct RatedEnvelope<Rating>: Equatable, Sendable {
|
||||||
public var maximum: Double
|
public var maximum: Double
|
||||||
public var minimum: Double
|
public var minimum: Double
|
||||||
public var rated: Double
|
public var rated: Double
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public struct Velocity: Equatable {
|
public struct Velocity: Equatable, Sendable {
|
||||||
public var airflow: Double
|
public var airflow: Double
|
||||||
public var dimension: PlenumDimension
|
public var dimension: PlenumDimension
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user