|
13 | 13 | // |
14 | 14 | //===----------------------------------------------------------------------===// |
15 | 15 |
|
| 16 | +#if swift(>=5.5) && canImport(_Concurrency) |
| 17 | +public typealias _Baggage_Sendable = Swift.Sendable |
| 18 | +#else |
| 19 | +public typealias _Baggage_Sendable = Any |
| 20 | +#endif |
| 21 | + |
16 | 22 | /// A `Baggage` is a heterogeneous storage type with value semantics for keyed values in a type-safe fashion. |
17 | 23 | /// |
18 | 24 | /// Its values are uniquely identified via `BaggageKey`s (by type identity). These keys also dictate the type of |
|
65 | 71 | /// `Baggage` does not expose more functions on purpose to prevent abuse and treating it as too much of an |
66 | 72 | /// arbitrary value smuggling container, but only make it convenient for tracing and instrumentation systems which need |
67 | 73 | /// to access either specific or all items carried inside a baggage. |
68 | | -public struct Baggage { |
69 | | - private var _storage = [AnyBaggageKey: Any]() |
| 74 | +public struct Baggage: _Baggage_Sendable { |
| 75 | + private var _storage = [AnyBaggageKey: _Baggage_Sendable]() |
70 | 76 |
|
71 | 77 | /// Internal on purpose, please use `Baggage.TODO` or `Baggage.topLevel` to create an "empty" baggage, |
72 | 78 | /// which carries more meaning to other developers why an empty baggage was used. |
@@ -151,7 +157,7 @@ extension Baggage { |
151 | 157 |
|
152 | 158 | /// Carried automatically by a "to do" baggage. |
153 | 159 | /// It can be used to track where a baggage originated and which "to do" baggage must be fixed into a real one to avoid this. |
154 | | -public struct TODOLocation { |
| 160 | +public struct TODOLocation: _Baggage_Sendable { |
155 | 161 | /// Source file location where the to-do `Baggage` was created |
156 | 162 | public let file: String |
157 | 163 | /// Source line location where the to-do `Baggage` was created |
|
0 commit comments