@@ -35,11 +35,12 @@ use std::task::Poll;
3535
3636use logforth_core:: Diagnostic ;
3737use logforth_core:: Error ;
38- use logforth_core:: kv:: { KeyOwned , ValueOwned } ;
39- use logforth_core:: kv:: { KeyView , ValueView , Visitor } ;
38+ use logforth_core:: kv:: KeyOwned ;
39+ use logforth_core:: kv:: ValueOwned ;
40+ use logforth_core:: kv:: Visitor ;
4041
4142thread_local ! {
42- static TASK_LOCAL_MAP : RefCell <Vec <( KeyView < ' _> , ValueView < ' _> ) >> = const { RefCell :: new( Vec :: new( ) ) } ;
43+ static TASK_LOCAL_MAP : RefCell <Vec <( KeyOwned , ValueOwned ) >> = const { RefCell :: new( Vec :: new( ) ) } ;
4344}
4445
4546/// A diagnostic that stores key-value pairs in a task-local context.
@@ -54,7 +55,7 @@ impl Diagnostic for TaskLocalDiagnostic {
5455 TASK_LOCAL_MAP . with ( |map| {
5556 let map = map. borrow ( ) ;
5657 for ( key, value) in map. iter ( ) {
57- visitor. visit ( * key, * value) ?;
58+ visitor. visit ( key. view ( ) , value. view ( ) ) ?;
5859 }
5960 Ok ( ( ) )
6061 } )
@@ -114,17 +115,14 @@ impl<F: Future> Future for TaskLocalFuture<F> {
114115 TASK_LOCAL_MAP . with ( |map| {
115116 let mut map = map. borrow_mut ( ) ;
116117 for ( key, value) in this. context . iter ( ) {
117- map. push ( ( key. view ( ) , value. view ( ) ) ) ;
118+ map. push ( ( key. clone ( ) , value. clone ( ) ) ) ;
118119 }
119120 } ) ;
120121
121122 let n = this. context . len ( ) ;
122123 let guard = Guard { n } ;
123124
124- let result = match future. poll ( cx) {
125- Poll :: Ready ( output) => Poll :: Ready ( output) ,
126- Poll :: Pending => Poll :: Pending ,
127- } ;
125+ let result = future. poll ( cx) ;
128126
129127 drop ( guard) ;
130128 result
0 commit comments