feat: Begin using Tagged types
All checks were successful
CI / Linux Tests (push) Successful in 5m23s

This commit is contained in:
2026-01-29 17:10:35 -05:00
parent 18a5ef06d3
commit 9379774fae
22 changed files with 167 additions and 150 deletions

View File

@@ -1,4 +1,17 @@
import Foundation
import Tagged
extension Tagged where RawValue == Double {
public func string(digits: Int = 2) -> String {
rawValue.string(digits: digits)
}
}
extension Tagged where RawValue == Int {
public func string() -> String {
rawValue.string()
}
}
extension Double {

View File

@@ -7,13 +7,13 @@ public struct FrictionRate: Codable, Equatable, Sendable {
/// minus the ``ComponentPressureLoss``es for the project.
public let availableStaticPressure: Double
/// The calculated design friction rate value.
public let value: Double
public let value: DesignFrictionRate
/// Whether the design friction rate is within a valid range.
public var hasErrors: Bool { error != nil }
public init(
availableStaticPressure: Double,
value: Double
value: DesignFrictionRate
) {
self.availableStaticPressure = availableStaticPressure
self.value = value

View File

@@ -0,0 +1,7 @@
import Tagged
public enum CFMTag {}
public typealias CFM = Tagged<CFMTag, Int>
public enum DesignFrictionRateTag {}
public typealias DesignFrictionRate = Tagged<DesignFrictionRateTag, Double>