113
113
//! </div>
114
114
//! <div class="example-wrap" style="display:inline-block">
115
115
//! <pre class="ignore" style="white-space:normal;font:inherit;">
116
- //! <strong>Note</strong>:the thread-local scoped dispatcher
117
- //! (<a href="#fn.with_default"><code>with_default</code></a>) requires the
118
- //! Rust standard library. <code>no_std</code> users should use
119
- //! <a href="#fn.set_global_default"><code>set_global_default</code></a>
120
- //! instead.
116
+ //!
117
+ //! **Note**: the thread-local scoped dispatcher ([`with_default`]) requires the
118
+ //! Rust standard library. `no_std` users should use [`set_global_default`] instead.
119
+ //!
121
120
//! </pre></div>
122
121
//!
123
122
//! ## Accessing the Default Subscriber
126
125
//! [`get_default`] function, which executes a closure with a reference to the
127
126
//! currently default `Dispatch`. This is used primarily by `tracing`
128
127
//! instrumentation.
129
- //!
130
- //! [`Subscriber`]: struct.Subscriber.html
131
- //! [`with_default`]: fn.with_default.html
132
- //! [`set_global_default`]: fn.set_global_default.html
133
- //! [`get_default`]: fn.get_default.html
134
- //! [`Dispatch`]: struct.Dispatch.html
135
128
use crate :: {
136
129
callsite, span,
137
130
subscriber:: { self , Subscriber } ,
@@ -154,8 +147,6 @@ use crate::stdlib::{
154
147
} ;
155
148
156
149
/// `Dispatch` trace data to a [`Subscriber`].
157
- ///
158
- /// [`Subscriber`]: trait.Subscriber.html
159
150
#[ derive( Clone ) ]
160
151
pub struct Dispatch {
161
152
subscriber : Arc < dyn Subscriber + Send + Sync > ,
@@ -217,14 +208,15 @@ pub struct DefaultGuard(Option<Dispatch>);
217
208
/// <div class="example-wrap" style="display:inline-block">
218
209
/// <pre class="ignore" style="white-space:normal;font:inherit;">
219
210
/// <strong>Note</strong>: This function required the Rust standard library.
220
- /// <code>no_std</code> users should use <a href="../fn.set_global_default.html">
221
- /// <code>set_global_default</code></a> instead.
211
+ /// <!-- hack: this whitespace makes rustdoc interpret the next line as markdown again -->
212
+ ///
213
+ /// `no_std` users should use [`set_global_default`] instead.
214
+ ///
222
215
/// </pre></div>
223
216
///
224
- /// [span]: ../span/index.html
225
- /// [`Subscriber`]: ../subscriber/trait.Subscriber.html
226
- /// [`Event`]: ../event/struct.Event.html
227
- /// [`set_global_default`]: ../fn.set_global_default.html
217
+ /// [span]: super::span
218
+ /// [`Subscriber`]: super::subscriber::Subscriber
219
+ /// [`Event`]: super::event::Event
228
220
#[ cfg( feature = "std" ) ]
229
221
#[ cfg_attr( docsrs, doc( cfg( feature = "std" ) ) ) ]
230
222
pub fn with_default < T > ( dispatcher : & Dispatch , f : impl FnOnce ( ) -> T ) -> T {
@@ -244,12 +236,11 @@ pub fn with_default<T>(dispatcher: &Dispatch, f: impl FnOnce() -> T) -> T {
244
236
/// </div>
245
237
/// <div class="example-wrap" style="display:inline-block">
246
238
/// <pre class="ignore" style="white-space:normal;font:inherit;">
247
- /// <strong>Note</strong>: This function required the Rust standard library.
248
- /// <code>no_std</code> users should use <a href="../fn.set_global_default.html">
249
- /// <code>set_global_default</code></a> instead.
250
- /// </pre></div>
251
239
///
252
- /// [`set_global_default`]: ../fn.set_global_default.html
240
+ /// **Note**: This function required the Rust standard library.
241
+ /// `no_std` users should use [`set_global_default`] instead.
242
+ ///
243
+ /// </pre></div>
253
244
#[ cfg( feature = "std" ) ]
254
245
#[ cfg_attr( docsrs, doc( cfg( feature = "std" ) ) ) ]
255
246
#[ must_use = "Dropping the guard unregisters the dispatcher." ]
@@ -276,9 +267,9 @@ pub fn set_default(dispatcher: &Dispatch) -> DefaultGuard {
276
267
/// executables that depend on the library try to set the default later.
277
268
/// </pre></div>
278
269
///
279
- /// [span]: ../ span/index.html
280
- /// [`Subscriber`]: ../ subscriber/trait. Subscriber.html
281
- /// [`Event`]: ../ event/struct. Event.html
270
+ /// [span]: super:: span
271
+ /// [`Subscriber`]: super:: subscriber:: Subscriber
272
+ /// [`Event`]: super:: event:: Event
282
273
pub fn set_global_default ( dispatcher : Dispatch ) -> Result < ( ) , SetGlobalDefaultError > {
283
274
if GLOBAL_INIT . compare_and_swap ( UNINITIALIZED , INITIALIZING , Ordering :: SeqCst ) == UNINITIALIZED
284
275
{
@@ -325,7 +316,7 @@ impl error::Error for SetGlobalDefaultError {}
325
316
/// called while inside of another `get_default`, that closure will be provided
326
317
/// with `Dispatch::none` rather than the previously set dispatcher.
327
318
///
328
- /// [dispatcher]: ../ dispatcher/struct. Dispatch.html
319
+ /// [dispatcher]: super:: dispatcher:: Dispatch
329
320
#[ cfg( feature = "std" ) ]
330
321
pub fn get_default < T , F > ( mut f : F ) -> T
331
322
where
@@ -348,7 +339,7 @@ where
348
339
/// called while inside of another `get_default`, that closure will be provided
349
340
/// with `Dispatch::none` rather than the previously set dispatcher.
350
341
///
351
- /// [dispatcher]: ../ dispatcher/struct. Dispatch.html
342
+ /// [dispatcher]: super:: dispatcher:: Dispatch
352
343
#[ cfg( feature = "std" ) ]
353
344
#[ doc( hidden) ]
354
345
#[ inline( never) ]
@@ -363,7 +354,7 @@ pub fn get_current<T>(f: impl FnOnce(&Dispatch) -> T) -> Option<T> {
363
354
364
355
/// Executes a closure with a reference to the current [dispatcher].
365
356
///
366
- /// [dispatcher]: ../ dispatcher/struct. Dispatch.html
357
+ /// [dispatcher]: super:: dispatcher:: Dispatch
367
358
#[ cfg( not( feature = "std" ) ) ]
368
359
#[ doc( hidden) ]
369
360
pub fn get_current < T > ( f : impl FnOnce ( & Dispatch ) -> T ) -> Option < T > {
@@ -373,7 +364,7 @@ pub fn get_current<T>(f: impl FnOnce(&Dispatch) -> T) -> Option<T> {
373
364
374
365
/// Executes a closure with a reference to the current [dispatcher].
375
366
///
376
- /// [dispatcher]: ../ dispatcher/struct. Dispatch.html
367
+ /// [dispatcher]: super:: dispatcher:: Dispatch
377
368
#[ cfg( not( feature = "std" ) ) ]
378
369
pub fn get_default < T , F > ( mut f : F ) -> T
379
370
where
@@ -412,7 +403,7 @@ impl Dispatch {
412
403
413
404
/// Returns a `Dispatch` that forwards to the given [`Subscriber`].
414
405
///
415
- /// [`Subscriber`]: ../ subscriber/trait. Subscriber.html
406
+ /// [`Subscriber`]: super:: subscriber:: Subscriber
416
407
pub fn new < S > ( subscriber : S ) -> Self
417
408
where
418
409
S : Subscriber + Send + Sync + ' static ,
@@ -434,8 +425,8 @@ impl Dispatch {
434
425
/// This calls the [`register_callsite`] function on the [`Subscriber`]
435
426
/// that this `Dispatch` forwards to.
436
427
///
437
- /// [`Subscriber`]: ../ subscriber/trait. Subscriber.html
438
- /// [`register_callsite`]: ../ subscriber/trait. Subscriber.html#method. register_callsite
428
+ /// [`Subscriber`]: super:: subscriber:: Subscriber
429
+ /// [`register_callsite`]: super:: subscriber:: Subscriber:: register_callsite
439
430
#[ inline]
440
431
pub fn register_callsite ( & self , metadata : & ' static Metadata < ' static > ) -> subscriber:: Interest {
441
432
self . subscriber . register_callsite ( metadata)
@@ -448,9 +439,9 @@ impl Dispatch {
448
439
/// This calls the [`max_level_hint`] function on the [`Subscriber`]
449
440
/// that this `Dispatch` forwards to.
450
441
///
451
- /// [level]: ../struct. Level.html
452
- /// [`Subscriber`]: ../ subscriber/trait. Subscriber.html
453
- /// [`register_callsite`]: ../ subscriber/trait. Subscriber.html#method. max_level_hint
442
+ /// [level]: super:: Level
443
+ /// [`Subscriber`]: super:: subscriber:: Subscriber
444
+ /// [`register_callsite`]: super:: subscriber:: Subscriber:: max_level_hint
454
445
// TODO(eliza): consider making this a public API?
455
446
#[ inline]
456
447
pub ( crate ) fn max_level_hint ( & self ) -> Option < LevelFilter > {
@@ -463,9 +454,9 @@ impl Dispatch {
463
454
/// This calls the [`new_span`] function on the [`Subscriber`] that this
464
455
/// `Dispatch` forwards to.
465
456
///
466
- /// [ID]: ../ span/struct.Id.html
467
- /// [`Subscriber`]: ../ subscriber/trait. Subscriber.html
468
- /// [`new_span`]: ../ subscriber/trait. Subscriber.html#method. new_span
457
+ /// [ID]: super:: span::Id
458
+ /// [`Subscriber`]: super:: subscriber:: Subscriber
459
+ /// [`new_span`]: super:: subscriber:: Subscriber:: new_span
469
460
#[ inline]
470
461
pub fn new_span ( & self , span : & span:: Attributes < ' _ > ) -> span:: Id {
471
462
self . subscriber . new_span ( span)
@@ -476,8 +467,8 @@ impl Dispatch {
476
467
/// This calls the [`record`] function on the [`Subscriber`] that this
477
468
/// `Dispatch` forwards to.
478
469
///
479
- /// [`Subscriber`]: ../ subscriber/trait. Subscriber.html
480
- /// [`record`]: ../ subscriber/trait. Subscriber.html#method. record
470
+ /// [`Subscriber`]: super:: subscriber:: Subscriber
471
+ /// [`record`]: super:: subscriber:: Subscriber:: record
481
472
#[ inline]
482
473
pub fn record ( & self , span : & span:: Id , values : & span:: Record < ' _ > ) {
483
474
self . subscriber . record ( span, values)
@@ -489,8 +480,8 @@ impl Dispatch {
489
480
/// This calls the [`record_follows_from`] function on the [`Subscriber`]
490
481
/// that this `Dispatch` forwards to.
491
482
///
492
- /// [`Subscriber`]: ../ subscriber/trait. Subscriber.html
493
- /// [`record_follows_from`]: ../ subscriber/trait. Subscriber.html#method. record_follows_from
483
+ /// [`Subscriber`]: super:: subscriber:: Subscriber
484
+ /// [`record_follows_from`]: super:: subscriber:: Subscriber:: record_follows_from
494
485
#[ inline]
495
486
pub fn record_follows_from ( & self , span : & span:: Id , follows : & span:: Id ) {
496
487
self . subscriber . record_follows_from ( span, follows)
@@ -502,9 +493,9 @@ impl Dispatch {
502
493
/// This calls the [`enabled`] function on the [`Subscriber`] that this
503
494
/// `Dispatch` forwards to.
504
495
///
505
- /// [metadata]: ../ metadata/struct. Metadata.html
506
- /// [`Subscriber`]: ../ subscriber/trait. Subscriber.html
507
- /// [`enabled`]: ../ subscriber/trait. Subscriber.html#method. enabled
496
+ /// [metadata]: super:: metadata:: Metadata
497
+ /// [`Subscriber`]: super:: subscriber:: Subscriber
498
+ /// [`enabled`]: super:: subscriber:: Subscriber:: enabled
508
499
#[ inline]
509
500
pub fn enabled ( & self , metadata : & Metadata < ' _ > ) -> bool {
510
501
self . subscriber . enabled ( metadata)
@@ -515,9 +506,9 @@ impl Dispatch {
515
506
/// This calls the [`event`] function on the [`Subscriber`] that this
516
507
/// `Dispatch` forwards to.
517
508
///
518
- /// [`Event`]: ../ event/struct. Event.html
519
- /// [`Subscriber`]: ../ subscriber/trait. Subscriber.html
520
- /// [`event`]: ../ subscriber/trait. Subscriber.html#method. event
509
+ /// [`Event`]: super:: event:: Event
510
+ /// [`Subscriber`]: super:: subscriber:: Subscriber
511
+ /// [`event`]: super:: subscriber:: Subscriber:: event
521
512
#[ inline]
522
513
pub fn event ( & self , event : & Event < ' _ > ) {
523
514
self . subscriber . event ( event)
@@ -528,8 +519,8 @@ impl Dispatch {
528
519
/// This calls the [`enter`] function on the [`Subscriber`] that this
529
520
/// `Dispatch` forwards to.
530
521
///
531
- /// [`Subscriber`]: ../ subscriber/trait. Subscriber.html
532
- /// [`enter`]: ../ subscriber/trait. Subscriber.html#method. enter
522
+ /// [`Subscriber`]: super:: subscriber:: Subscriber
523
+ /// [`enter`]: super:: subscriber:: Subscriber:: enter
533
524
#[ inline]
534
525
pub fn enter ( & self , span : & span:: Id ) {
535
526
self . subscriber . enter ( span) ;
@@ -540,8 +531,8 @@ impl Dispatch {
540
531
/// This calls the [`exit`] function on the [`Subscriber`] that this
541
532
/// `Dispatch` forwards to.
542
533
///
543
- /// [`Subscriber`]: ../ subscriber/trait. Subscriber.html
544
- /// [`exit`]: ../ subscriber/trait. Subscriber.html#method. exit
534
+ /// [`Subscriber`]: super:: subscriber:: Subscriber
535
+ /// [`exit`]: super:: subscriber:: Subscriber:: exit
545
536
#[ inline]
546
537
pub fn exit ( & self , span : & span:: Id ) {
547
538
self . subscriber . exit ( span) ;
@@ -557,10 +548,10 @@ impl Dispatch {
557
548
/// This calls the [`clone_span`] function on the `Subscriber` that this
558
549
/// `Dispatch` forwards to.
559
550
///
560
- /// [span ID]: ../ span/struct.Id.html
561
- /// [`Subscriber`]: ../ subscriber/trait. Subscriber.html
562
- /// [`clone_span`]: ../ subscriber/trait. Subscriber.html#method. clone_span
563
- /// [`new_span`]: ../ subscriber/trait. Subscriber.html#method. new_span
551
+ /// [span ID]: super:: span::Id
552
+ /// [`Subscriber`]: super:: subscriber:: Subscriber
553
+ /// [`clone_span`]: super:: subscriber:: Subscriber:: clone_span
554
+ /// [`new_span`]: super:: subscriber:: Subscriber:: new_span
564
555
#[ inline]
565
556
pub fn clone_span ( & self , id : & span:: Id ) -> span:: Id {
566
557
self . subscriber . clone_span ( & id)
@@ -580,16 +571,17 @@ impl Dispatch {
580
571
/// <div class="tooltip compile_fail" style="">⚠ ️<span class="tooltiptext">Warning</span></div>
581
572
/// </div>
582
573
/// <div class="example-wrap" style="display:inline-block"><pre class="compile_fail" style="white-space:normal;font:inherit;">
583
- /// <strong>Deprecated</strong>: The <a href="#method.try_close"><code>try_close</code></a>
584
- /// method is functionally identical, but returns <code> true</code> if the span is now closed.
574
+ ///
575
+ /// **Deprecated**: The [`try_close`] method is functionally identical, but returns ` true` if the span is now closed.
585
576
/// It should be used instead of this method.
577
+ ///
586
578
/// </pre></div>
587
579
///
588
- /// [span ID]: ../ span/struct.Id.html
589
- /// [`Subscriber`]: ../ subscriber/trait. Subscriber.html
590
- /// [`drop_span`]: ../ subscriber/trait. Subscriber.html#method. drop_span
591
- /// [`new_span`]: ../ subscriber/trait. Subscriber.html#method. new_span
592
- /// [`try_close`]: #method. try_close
580
+ /// [span ID]: super:: span::Id
581
+ /// [`Subscriber`]: super:: subscriber:: Subscriber
582
+ /// [`drop_span`]: super:: subscriber:: Subscriber:: drop_span
583
+ /// [`new_span`]: super:: subscriber:: Subscriber:: new_span
584
+ /// [`try_close`]: Self:: try_close
593
585
#[ inline]
594
586
#[ deprecated( since = "0.1.2" , note = "use `Dispatch::try_close` instead" ) ]
595
587
pub fn drop_span ( & self , id : span:: Id ) {
@@ -608,10 +600,10 @@ impl Dispatch {
608
600
/// This calls the [`try_close`] function on the [`Subscriber`] that this
609
601
/// `Dispatch` forwards to.
610
602
///
611
- /// [span ID]: ../ span/struct.Id.html
612
- /// [`Subscriber`]: ../ subscriber/trait. Subscriber.html
613
- /// [`try_close`]: ../ subscriber/trait. Subscriber.html#method. try_close
614
- /// [`new_span`]: ../ subscriber/trait. Subscriber.html#method. new_span
603
+ /// [span ID]: super:: span::Id
604
+ /// [`Subscriber`]: super:: subscriber:: Subscriber
605
+ /// [`try_close`]: super:: subscriber:: Subscriber:: try_close
606
+ /// [`new_span`]: super:: subscriber:: Subscriber:: new_span
615
607
#[ inline]
616
608
pub fn try_close ( & self , id : span:: Id ) -> bool {
617
609
self . subscriber . try_close ( id)
@@ -622,7 +614,7 @@ impl Dispatch {
622
614
/// This calls the [`current`] function on the `Subscriber` that this
623
615
/// `Dispatch` forwards to.
624
616
///
625
- /// [`current`]: ../ subscriber/trait. Subscriber.html#method.current
617
+ /// [`current`]: super:: subscriber:: Subscriber::current_span
626
618
#[ inline]
627
619
pub fn current_span ( & self ) -> span:: Current {
628
620
self . subscriber . current_span ( )
0 commit comments