Skip to content

Commit

Permalink
Merge pull request #4 from AverageHelper/master
Browse files Browse the repository at this point in the history
Declare conformance to `Sendable`
  • Loading branch information
colemancda authored Mar 22, 2023
2 parents 1c840fa + c088636 commit 4f90245
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Sources/Comparison.swift
Original file line number Diff line number Diff line change
Expand Up @@ -303,3 +303,12 @@ public extension String {
return .comparison(comparison)
}
}

#if swift(>=5.7)

extension Comparison: Sendable {}
extension Comparison.Modifier: Sendable {}
extension Comparison.Option: Sendable {}
extension Comparison.Operator: Sendable {}

#endif
7 changes: 7 additions & 0 deletions Sources/Compound.swift
Original file line number Diff line number Diff line change
Expand Up @@ -165,3 +165,10 @@ public func || (lhs: Predicate, rhs: [Predicate]) -> Predicate {
public prefix func ! (rhs: Predicate) -> Predicate {
return .compound(.not(rhs))
}

#if swift(>=5.7)

extension Compound: Sendable {}
extension Compound.Logical​Type: Sendable {}

#endif
6 changes: 6 additions & 0 deletions Sources/Context.swift
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,9 @@ extension PredicateContext: PredicateEvaluatable {
return try lhs.compare(rhs, operator: predicate.type, modifier: predicate.modifier, options: predicate.options)
}
}

#if swift(>=5.7)

extension PredicateContext: Sendable {}

#endif
6 changes: 6 additions & 0 deletions Sources/Error.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,9 @@ public enum PredicateError: Error {
case invalidKeyPath(PredicateKeyPath)
case invalidComparison(Value, Value, Comparison.Operator, Comparison.Modifier?, Set<Comparison.Option>)
}

#if swift(>=5.7)

extension PredicateError: Sendable {}

#endif
7 changes: 7 additions & 0 deletions Sources/Expression.swift
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,10 @@ public extension Expression {
return .comparison(comparison)
}
}

#if swift(>=5.7)

extension Expression: Sendable {}
extension ExpressionType: Sendable {}

#endif
8 changes: 8 additions & 0 deletions Sources/KeyPath.swift
Original file line number Diff line number Diff line change
Expand Up @@ -184,3 +184,11 @@ extension PredicateKeyPath.Operator: CustomStringConvertible {
return rawValue
}
}

#if swift(>=5.7)

extension PredicateKeyPath: Sendable {}
extension PredicateKeyPath.Key: Sendable {}
extension PredicateKeyPath.Operator: Sendable {}

#endif
7 changes: 7 additions & 0 deletions Sources/Predicate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,10 @@ extension Predicate: Codable {
}
}
}

#if swift(>=5.7)

extension Predicate: Sendable {}
extension PredicateType: Sendable {}

#endif
7 changes: 7 additions & 0 deletions Sources/Value.swift
Original file line number Diff line number Diff line change
Expand Up @@ -318,3 +318,10 @@ extension Double: PredicateValue {
extension Sequence where Element: PredicateValue {
public var predicateValue: Value { return .collection(self.map({ $0.predicateValue })) }
}

#if swift(>=5.7)

extension Value: Sendable {}
extension ValueType: Sendable {}

#endif

0 comments on commit 4f90245

Please sign in to comment.