1
1
import CoreGraphics
2
2
3
- @frozen public struct LogInterpolation : StringInterpolationProtocol {
3
+ @frozen public struct LogInterpolation : StringInterpolationProtocol , Sendable {
4
4
5
- @usableFromInline enum Value {
5
+ @usableFromInline enum Value : Sendable {
6
6
case literal( String )
7
- case string( ( ) -> String , alignment: LogStringAlignment , privacy: LogPrivacy )
8
- case convertible( ( ) -> CustomStringConvertible , alignment: LogStringAlignment , privacy: LogPrivacy )
9
- case signedInt( ( ) -> Int64 , format: LogIntegerFormatting , alignment: LogStringAlignment , privacy: LogPrivacy )
10
- case unsignedInt( ( ) -> UInt64 , format: LogIntegerFormatting , alignment: LogStringAlignment , privacy: LogPrivacy )
11
- case float( ( ) -> Float , format: LogFloatFormatting , alignment: LogStringAlignment , privacy: LogPrivacy )
12
- case cgfloat( ( ) -> CGFloat , format: LogFloatFormatting , alignment: LogStringAlignment , privacy: LogPrivacy )
13
- case double( ( ) -> Double , format: LogFloatFormatting , alignment: LogStringAlignment , privacy: LogPrivacy )
14
- case bool( ( ) -> Bool , format: LogBoolFormat , privacy: LogPrivacy )
15
- case object( ( ) -> NSObject , privacy: LogPrivacy )
16
- case meta( ( ) -> Any . Type , alignment: LogStringAlignment , privacy: LogPrivacy )
7
+ case string( @ Sendable ( ) -> String , alignment: LogStringAlignment , privacy: LogPrivacy )
8
+ case convertible( @ Sendable ( ) -> CustomStringConvertible , alignment: LogStringAlignment , privacy: LogPrivacy )
9
+ case signedInt( @ Sendable ( ) -> Int64 , format: LogIntegerFormatting , alignment: LogStringAlignment , privacy: LogPrivacy )
10
+ case unsignedInt( @ Sendable ( ) -> UInt64 , format: LogIntegerFormatting , alignment: LogStringAlignment , privacy: LogPrivacy )
11
+ case float( @ Sendable ( ) -> Float , format: LogFloatFormatting , alignment: LogStringAlignment , privacy: LogPrivacy )
12
+ case cgfloat( @ Sendable ( ) -> CGFloat , format: LogFloatFormatting , alignment: LogStringAlignment , privacy: LogPrivacy )
13
+ case double( @ Sendable ( ) -> Double , format: LogFloatFormatting , alignment: LogStringAlignment , privacy: LogPrivacy )
14
+ case bool( @ Sendable ( ) -> Bool , format: LogBoolFormat , privacy: LogPrivacy )
15
+ case object( @ Sendable ( ) -> NSObject , privacy: LogPrivacy )
16
+ case meta( @ Sendable ( ) -> Any . Type , alignment: LogStringAlignment , privacy: LogPrivacy )
17
17
}
18
18
19
19
private( set) var storage : [ Value ] = [ ]
@@ -28,77 +28,77 @@ import CoreGraphics
28
28
29
29
extension LogInterpolation {
30
30
/// Defines interpolation for expressions of type String.
31
- public mutating func appendInterpolation( _ argumentString: @autoclosure @escaping ( ) -> String , align: LogStringAlignment = . none, privacy: LogPrivacy = . private) {
31
+ public mutating func appendInterpolation( _ argumentString: @Sendable @ autoclosure @escaping ( ) -> String , align: LogStringAlignment = . none, privacy: LogPrivacy = . private) {
32
32
storage. append ( . string( argumentString, alignment: align, privacy: privacy) )
33
33
}
34
34
35
35
/// Defines interpolation for values conforming to CustomStringConvertible. The values
36
36
/// are displayed using the description methods on them.
37
- public mutating func appendInterpolation< T> ( _ value: @autoclosure @escaping ( ) -> T , align: LogStringAlignment = . none, privacy: LogPrivacy = . private) where T: CustomStringConvertible {
37
+ public mutating func appendInterpolation< T> ( _ value: @Sendable @ autoclosure @escaping ( ) -> T , align: LogStringAlignment = . none, privacy: LogPrivacy = . private) where T: CustomStringConvertible {
38
38
storage. append ( . convertible( value, alignment: align, privacy: privacy) )
39
39
}
40
40
}
41
41
42
42
extension LogInterpolation {
43
43
/// Defines interpolation for meta-types.
44
- public mutating func appendInterpolation( _ value: @autoclosure @escaping ( ) -> Any . Type , align: LogStringAlignment = . none, privacy: LogPrivacy = . private) {
44
+ public mutating func appendInterpolation( _ value: @Sendable @ autoclosure @escaping ( ) -> Any . Type , align: LogStringAlignment = . none, privacy: LogPrivacy = . private) {
45
45
storage. append ( . meta( value, alignment: align, privacy: privacy) )
46
46
}
47
47
48
48
/// Defines interpolation for expressions of type NSObject.
49
- public mutating func appendInterpolation( _ argumentObject: @autoclosure @escaping ( ) -> NSObject , privacy: LogPrivacy = . private) {
49
+ public mutating func appendInterpolation( _ argumentObject: @Sendable @ autoclosure @escaping ( ) -> NSObject , privacy: LogPrivacy = . private) {
50
50
storage. append ( . object( argumentObject, privacy: privacy) )
51
51
}
52
52
}
53
53
54
54
extension LogInterpolation {
55
55
/// Defines interpolation for expressions of type Int
56
- public mutating func appendInterpolation< T: SignedInteger > ( _ number: @autoclosure @escaping ( ) -> T , format: LogIntegerFormatting = . decimal, align: LogStringAlignment = . none, privacy: LogPrivacy = . private) {
56
+ public mutating func appendInterpolation< T: SignedInteger > ( _ number: @Sendable @ autoclosure @escaping ( ) -> T , format: LogIntegerFormatting = . decimal, align: LogStringAlignment = . none, privacy: LogPrivacy = . private) {
57
57
storage. append ( . signedInt( { Int64 ( number ( ) ) } , format: format, alignment: align, privacy: privacy) )
58
58
}
59
59
60
60
/// Defines interpolation for expressions of type UInt
61
- public mutating func appendInterpolation< T: UnsignedInteger > ( _ number: @autoclosure @escaping ( ) -> T , format: LogIntegerFormatting = . decimal, align: LogStringAlignment = . none, privacy: LogPrivacy = . private) {
61
+ public mutating func appendInterpolation< T: UnsignedInteger > ( _ number: @Sendable @ autoclosure @escaping ( ) -> T , format: LogIntegerFormatting = . decimal, align: LogStringAlignment = . none, privacy: LogPrivacy = . private) {
62
62
storage. append ( . unsignedInt( { UInt64 ( number ( ) ) } , format: format, alignment: align, privacy: privacy) )
63
63
}
64
64
}
65
65
66
66
extension LogInterpolation {
67
67
/// Defines interpolation for expressions of type Float
68
- public mutating func appendInterpolation( _ number: @autoclosure @escaping ( ) -> Float , format: LogFloatFormatting = . fixed, align: LogStringAlignment = . none, privacy: LogPrivacy = . private) {
68
+ public mutating func appendInterpolation( _ number: @Sendable @ autoclosure @escaping ( ) -> Float , format: LogFloatFormatting = . fixed, align: LogStringAlignment = . none, privacy: LogPrivacy = . private) {
69
69
storage. append ( . float( number, format: format, alignment: align, privacy: privacy) )
70
70
}
71
71
72
72
/// Defines interpolation for expressions of type CGFloat
73
- public mutating func appendInterpolation( _ number: @autoclosure @escaping ( ) -> CGFloat , format: LogFloatFormatting = . fixed, align: LogStringAlignment = . none, privacy: LogPrivacy = . private) {
73
+ public mutating func appendInterpolation( _ number: @Sendable @ autoclosure @escaping ( ) -> CGFloat , format: LogFloatFormatting = . fixed, align: LogStringAlignment = . none, privacy: LogPrivacy = . private) {
74
74
storage. append ( . cgfloat( number, format: format, alignment: align, privacy: privacy) )
75
75
}
76
76
77
77
/// Defines interpolation for expressions of type Double
78
- public mutating func appendInterpolation( _ number: @autoclosure @escaping ( ) -> Double , format: LogFloatFormatting = . fixed, align: LogStringAlignment = . none, privacy: LogPrivacy = . private) {
78
+ public mutating func appendInterpolation( _ number: @Sendable @ autoclosure @escaping ( ) -> Double , format: LogFloatFormatting = . fixed, align: LogStringAlignment = . none, privacy: LogPrivacy = . private) {
79
79
storage. append ( . double( number, format: format, alignment: align, privacy: privacy) )
80
80
}
81
81
}
82
82
83
83
extension LogInterpolation {
84
84
/// Defines interpolation for expressions of type Bool
85
- public mutating func appendInterpolation( _ boolean: @autoclosure @escaping ( ) -> Bool , format: LogBoolFormat = . truth, privacy: LogPrivacy = . private) {
85
+ public mutating func appendInterpolation( _ boolean: @Sendable @ autoclosure @escaping ( ) -> Bool , format: LogBoolFormat = . truth, privacy: LogPrivacy = . private) {
86
86
storage. append ( . bool( boolean, format: format, privacy: privacy) )
87
87
}
88
88
}
89
89
90
- public enum LogBoolFormat {
90
+ public enum LogBoolFormat : Sendable {
91
91
/// Displays an interpolated boolean value as true or false.
92
92
case truth
93
93
/// Displays an interpolated boolean value as yes or no.
94
94
case answer
95
95
}
96
96
97
- public struct LogStringAlignment {
98
- enum Alignment {
97
+ public struct LogStringAlignment : Sendable {
98
+ enum Alignment : Sendable {
99
99
case none
100
- case left( columns: ( ) -> Int )
101
- case right( columns: ( ) -> Int )
100
+ case left( columns: @ Sendable ( ) -> Int )
101
+ case right( columns: @ Sendable ( ) -> Int )
102
102
}
103
103
104
104
let alignment : Alignment
@@ -107,18 +107,18 @@ public struct LogStringAlignment {
107
107
LogStringAlignment ( alignment: . none)
108
108
}
109
109
110
- public static func right( columns: @autoclosure @escaping ( ) -> Int ) -> LogStringAlignment {
110
+ public static func right( columns: @Sendable @ autoclosure @escaping ( ) -> Int ) -> LogStringAlignment {
111
111
LogStringAlignment ( alignment: . right( columns: columns) )
112
112
}
113
113
114
- public static func left( columns: @autoclosure @escaping ( ) -> Int ) -> LogStringAlignment {
114
+ public static func left( columns: @Sendable @ autoclosure @escaping ( ) -> Int ) -> LogStringAlignment {
115
115
LogStringAlignment ( alignment: . left( columns: columns) )
116
116
}
117
117
}
118
118
119
- public struct LogFloatFormatting {
120
- enum Format {
121
- case fixed( precision: ( ) -> Int , explicitPositiveSign: Bool )
119
+ public struct LogFloatFormatting : Sendable {
120
+ enum Format : Sendable {
121
+ case fixed( precision: @ Sendable ( ) -> Int , explicitPositiveSign: Bool )
122
122
}
123
123
124
124
let format : Format
@@ -131,14 +131,14 @@ public struct LogFloatFormatting {
131
131
fixed ( precision: 6 , explicitPositiveSign: explicitPositiveSign)
132
132
}
133
133
134
- public static func fixed( precision: @autoclosure @escaping ( ) -> Int , explicitPositiveSign: Bool = false ) -> LogFloatFormatting {
134
+ public static func fixed( precision: @Sendable @ autoclosure @escaping ( ) -> Int , explicitPositiveSign: Bool = false ) -> LogFloatFormatting {
135
135
LogFloatFormatting ( format: . fixed( precision: precision, explicitPositiveSign: explicitPositiveSign) )
136
136
}
137
137
}
138
138
139
- public struct LogIntegerFormatting {
139
+ public struct LogIntegerFormatting : Sendable {
140
140
enum Format {
141
- case decimal( minDigits: ( ) -> Int , explicitPositiveSign: Bool )
141
+ case decimal( minDigits: @ Sendable ( ) -> Int , explicitPositiveSign: Bool )
142
142
}
143
143
144
144
let format : Format
@@ -151,13 +151,13 @@ public struct LogIntegerFormatting {
151
151
decimal ( explicitPositiveSign: explicitPositiveSign, minDigits: 0 )
152
152
}
153
153
154
- public static func decimal( explicitPositiveSign: Bool = false , minDigits: @autoclosure @escaping ( ) -> Int ) -> LogIntegerFormatting {
154
+ public static func decimal( explicitPositiveSign: Bool = false , minDigits: @Sendable @ autoclosure @escaping ( ) -> Int ) -> LogIntegerFormatting {
155
155
LogIntegerFormatting ( format: . decimal( minDigits: minDigits, explicitPositiveSign: explicitPositiveSign) )
156
156
}
157
157
}
158
158
159
- @frozen public struct LogPrivacy : Equatable {
160
- public enum Mask : Equatable {
159
+ @frozen public struct LogPrivacy : Equatable , Sendable {
160
+ public enum Mask : Equatable , Sendable {
161
161
case hash
162
162
case none
163
163
}
0 commit comments