Skip to content

Commit 4513d31

Browse files
authored
Merge pull request #6 from adam-fowler/sendable
Sendable conformance
2 parents afc4fdb + 166c1a0 commit 4513d31

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

Sources/JMESPath/Ast.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public indirect enum Ast: Equatable {
3939
}
4040

4141
/// Comparator used in comparison AST nodes
42-
public enum Comparator: Equatable {
42+
public enum Comparator: Equatable, JMESSendable {
4343
case equal
4444
case notEqual
4545
case lessThan
@@ -61,3 +61,9 @@ public enum Comparator: Equatable {
6161
}
6262
}
6363
}
64+
65+
#if compiler(>=5.6)
66+
// have to force Sendable conformance as enum `.literal` uses `JMESVariable` which
67+
// is not necessarily sendable but in the use here it is
68+
extension Ast: @unchecked Sendable {}
69+
#endif

Sources/JMESPath/Expression.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import Foundation
33
/// JMES Expression
44
///
55
/// Holds a compiled JMES expression and allows you to search Json text or a type already in memory
6-
public struct JMESExpression {
6+
public struct JMESExpression: JMESSendable {
77
let ast: Ast
88

99
public static func compile(_ text: String) throws -> Self {

Sources/JMESPath/Sendable.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Sendable support
2+
3+
#if compiler(>=5.6)
4+
public typealias JMESSendable = Sendable
5+
#else
6+
public typealias JMESSendable = Any
7+
#endif

0 commit comments

Comments
 (0)