File tree 1 file changed +7
-3
lines changed 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -15,8 +15,10 @@ pub struct WorkerLocal<T> {
15
15
registry : Arc < Registry > ,
16
16
}
17
17
18
- unsafe impl < T > Send for WorkerLocal < T > { }
19
- unsafe impl < T > Sync for WorkerLocal < T > { }
18
+ /// We prevent concurrent access to the underlying value in the
19
+ /// Deref impl, thus any values safe to send across threads can
20
+ /// be used with WorkerLocal.
21
+ unsafe impl < T : Send > Sync for WorkerLocal < T > { }
20
22
21
23
impl < T > WorkerLocal < T > {
22
24
/// Creates a new worker local where the `initial` closure computes the
@@ -60,7 +62,9 @@ impl<T> WorkerLocal<Vec<T>> {
60
62
61
63
impl < T : fmt:: Debug > fmt:: Debug for WorkerLocal < T > {
62
64
fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
63
- fmt:: Debug :: fmt ( & self . locals , f)
65
+ f. debug_struct ( "WorkerLocal" )
66
+ . field ( "registry" , & self . registry . id ( ) )
67
+ . finish ( )
64
68
}
65
69
}
66
70
You can’t perform that action at this time.
0 commit comments