@@ -235,6 +235,11 @@ pub struct Scope<'a, R> {
235
235
feature ! {
236
236
#![ any( feature = "alloc" , feature = "std" ) ]
237
237
238
+ use alloc:: {
239
+ boxed:: Box ,
240
+ sync:: Arc
241
+ } ;
242
+
238
243
#[ cfg( not( feature = "smallvec" ) ) ]
239
244
use alloc:: vec:: { self , Vec } ;
240
245
use core:: { fmt, iter} ;
@@ -255,6 +260,66 @@ feature! {
255
260
#[ cfg( feature = "smallvec" ) ]
256
261
type SpanRefVecArray <' span, L > = [ SpanRef <' span, L >; 16 ] ;
257
262
263
+ impl <' a, S > LookupSpan <' a> for Arc <S >
264
+ where
265
+ S : LookupSpan <' a>,
266
+ {
267
+ type Data = <S as LookupSpan <' a>>:: Data ;
268
+
269
+ fn span_data( & ' a self , id: & Id ) -> Option <Self :: Data > {
270
+ self . as_ref( ) . span_data( id)
271
+ }
272
+
273
+ fn span( & ' a self , id: & Id ) -> Option <SpanRef <' _, Self >>
274
+ where
275
+ Self : Sized ,
276
+ {
277
+ self . as_ref( ) . span( id) . map(
278
+ |SpanRef {
279
+ registry: _,
280
+ data,
281
+ #[ cfg( feature = "registry" ) ]
282
+ filter,
283
+ } | SpanRef {
284
+ registry: self ,
285
+ data,
286
+ #[ cfg( feature = "registry" ) ]
287
+ filter,
288
+ } ,
289
+ )
290
+ }
291
+ }
292
+
293
+ impl <' a, S > LookupSpan <' a> for Box <S >
294
+ where
295
+ S : LookupSpan <' a>,
296
+ {
297
+ type Data = <S as LookupSpan <' a>>:: Data ;
298
+
299
+ fn span_data( & ' a self , id: & Id ) -> Option <Self :: Data > {
300
+ self . as_ref( ) . span_data( id)
301
+ }
302
+
303
+ fn span( & ' a self , id: & Id ) -> Option <SpanRef <' _, Self >>
304
+ where
305
+ Self : Sized ,
306
+ {
307
+ self . as_ref( ) . span( id) . map(
308
+ |SpanRef {
309
+ registry: _,
310
+ data,
311
+ #[ cfg( feature = "registry" ) ]
312
+ filter,
313
+ } | SpanRef {
314
+ registry: self ,
315
+ data,
316
+ #[ cfg( feature = "registry" ) ]
317
+ filter,
318
+ } ,
319
+ )
320
+ }
321
+ }
322
+
258
323
impl <' a, R > Scope <' a, R >
259
324
where
260
325
R : LookupSpan <' a>,
0 commit comments