trace-core: Debreak RustDoc links (#961)

This commit fixes a bunch of broken links in the `tokio-trace-core` API
docs.

Refs: #957
This commit is contained in:
Eliza Weisman 2019-03-07 14:42:08 -08:00 committed by GitHub
parent d88aba8d1c
commit 7f911b6b70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 162 additions and 106 deletions

View File

@ -32,25 +32,27 @@ pub trait Callsite: Sync {
/// If the interest is greater than or equal to the callsite's current /// If the interest is greater than or equal to the callsite's current
/// interest, this should change whether or not the callsite is enabled. /// interest, this should change whether or not the callsite is enabled.
/// ///
/// [`Interest`]: ::subscriber::Interest /// [`Interest`]: ../subscriber/struct.Interest.html
/// [registering]: ::subscriber::Subscriber::register_callsite /// [registering]: ../subscriber/trait.Subscriber.html#method.register_callsite
/// [dispatcher]: ::Dispatch /// [dispatcher]: ../dispatcher/struct.Dispatch.html
fn add_interest(&self, interest: Interest); fn add_interest(&self, interest: Interest);
/// Remove _all_ [`Interest`] from the callsite, disabling it. /// Remove _all_ [`Interest`] from the callsite, disabling it.
/// ///
/// [`Interest`]: ::subscriber::Interest /// [`Interest`]: ../subscriber/struct.Interest.html
fn clear_interest(&self); fn clear_interest(&self);
/// Returns the [metadata] associated with the callsite. /// Returns the [metadata] associated with the callsite.
/// ///
/// [metadata]: ::Metadata /// [metadata]: ../metadata/struct.Metadata.html
fn metadata(&self) -> &Metadata; fn metadata(&self) -> &Metadata;
} }
/// Uniquely identifies a [`Callsite`](::callsite::Callsite). /// Uniquely identifies a [`Callsite`]
/// ///
/// Two `Identifier`s are equal if they both refer to the same callsite. /// Two `Identifier`s are equal if they both refer to the same callsite.
///
/// [`Callsite`]: ../callsite/trait.Callsite.html
#[derive(Clone)] #[derive(Clone)]
pub struct Identifier( pub struct Identifier(
/// **Warning**: The fields on this type are currently `pub` because it must /// **Warning**: The fields on this type are currently `pub` because it must

View File

@ -11,7 +11,9 @@ use std::{
sync::{Arc, Weak}, sync::{Arc, Weak},
}; };
/// `Dispatch` trace data to a [`Subscriber`](::Subscriber). /// `Dispatch` trace data to a [`Subscriber`].
///
/// [`Subscriber`]: ../subscriber/trait.Subscriber.html
#[derive(Clone)] #[derive(Clone)]
pub struct Dispatch { pub struct Dispatch {
subscriber: Arc<Subscriber + Send + Sync>, subscriber: Arc<Subscriber + Send + Sync>,
@ -29,8 +31,8 @@ thread_local! {
/// tagged that span, instead. /// tagged that span, instead.
/// ///
/// [span]: ../span/index.html /// [span]: ../span/index.html
/// [`Subscriber`]: ::Subscriber /// [`Subscriber`]: ../subscriber/trait.Subscriber.html
/// [`Event`]: ::Event /// [`Event`]: ../event/struct.Event.html
pub fn with_default<T>(dispatcher: Dispatch, f: impl FnOnce() -> T) -> T { pub fn with_default<T>(dispatcher: Dispatch, f: impl FnOnce() -> T) -> T {
// A drop guard that resets CURRENT_DISPATCH to the prior dispatcher. // A drop guard that resets CURRENT_DISPATCH to the prior dispatcher.
// Using this (rather than simply resetting after calling `f`) ensures // Using this (rather than simply resetting after calling `f`) ensures
@ -51,7 +53,9 @@ pub fn with_default<T>(dispatcher: Dispatch, f: impl FnOnce() -> T) -> T {
f() f()
} }
/// Executes a closure with a reference to this thread's current dispatcher. /// Executes a closure with a reference to this thread's current [dispatcher].
///
/// [dispatcher]: ../dispatcher/struct.Dispatch.html
pub fn with<T, F>(mut f: F) -> T pub fn with<T, F>(mut f: F) -> T
where where
F: FnMut(&Dispatch) -> T, F: FnMut(&Dispatch) -> T,
@ -71,7 +75,9 @@ impl Dispatch {
} }
} }
/// Returns a `Dispatch` to the given [`Subscriber`](::Subscriber). /// Returns a `Dispatch` that forwards to the given [`Subscriber`].
///
/// [`Subscriber`]: ../subscriber/trait.Subscriber.html
pub fn new<S>(subscriber: S) -> Self pub fn new<S>(subscriber: S) -> Self
where where
S: Subscriber + Send + Sync + 'static, S: Subscriber + Send + Sync + 'static,
@ -90,39 +96,50 @@ impl Dispatch {
/// Registers a new callsite with this subscriber, returning whether or not /// Registers a new callsite with this subscriber, returning whether or not
/// the subscriber is interested in being notified about the callsite. /// the subscriber is interested in being notified about the callsite.
/// ///
/// This calls the [`register_callsite`](::Subscriber::register_callsite) /// This calls the [`register_callsite`] function on the [`Subscriber`]
/// function on the `Subscriber` that this `Dispatch` forwards to. /// that this `Dispatch` forwards to.
///
/// [`Subscriber`]: ../subscriber/trait.Subscriber.html
/// [`register_callsite`]: ../subscriber/trait.Subscriber.html#method.register_callsite
#[inline] #[inline]
pub fn register_callsite(&self, metadata: &Metadata) -> subscriber::Interest { pub fn register_callsite(&self, metadata: &Metadata) -> subscriber::Interest {
self.subscriber.register_callsite(metadata) self.subscriber.register_callsite(metadata)
} }
/// Visit the construction of a new span, returning a new [ID] for the /// Record the construction of a new span, returning a new [ID] for the
/// span being constructed. /// span being constructed.
/// ///
/// This calls the [`new_span`](::Subscriber::new_span) /// This calls the [`new_span`] function on the [`Subscriber`] that this
/// function on the `Subscriber` that this `Dispatch` forwards to. /// `Dispatch` forwards to.
/// ///
/// [ID]: ../span/struct.Id.html /// [ID]: ../span/struct.Id.html
/// [`Subscriber`]: ../subscriber/trait.Subscriber.html
/// [`new_span`]: ../subscriber/trait.Subscriber.html#method.new_span
#[inline] #[inline]
pub fn new_span(&self, span: &span::Attributes) -> span::Id { pub fn new_span(&self, span: &span::Attributes) -> span::Id {
self.subscriber.new_span(span) self.subscriber.new_span(span)
} }
/// Visit a set of values on a span. /// Record a set of values on a span.
/// ///
/// This calls the [`record`](::Subscriber::record) /// This calls the [`record`] function on the [`Subscriber`] that this
/// function on the `Subscriber` that this `Dispatch` forwards to. /// `Dispatch` forwards to.
///
/// [`Subscriber`]: ../subscriber/trait.Subscriber.html
/// [`record`]: ../subscriber/trait.Subscriber.html#method.record
#[inline] #[inline]
pub fn record(&self, span: &span::Id, values: &span::Record) { pub fn record(&self, span: &span::Id, values: &span::Record) {
self.subscriber.record(span, &values) self.subscriber.record(span, values)
} }
/// Adds an indication that `span` follows from the span with the id /// Adds an indication that `span` follows from the span with the id
/// `follows`. /// `follows`.
/// ///
/// This calls the [`record_follows_from`](::Subscriber::record_follows_from) /// This calls the [`record_follows_from`] function on the [`Subscriber`]
/// function on the `Subscriber` that this `Dispatch` forwards to. /// that this `Dispatch` forwards to.
///
/// [`Subscriber`]: ../subscriber/trait.Subscriber.html
/// [`record_follows_from`]: ../subscriber/trait.Subscriber.html#method.record_follows_from
#[inline] #[inline]
pub fn record_follows_from(&self, span: &span::Id, follows: &span::Id) { pub fn record_follows_from(&self, span: &span::Id, follows: &span::Id) {
self.subscriber.record_follows_from(span, follows) self.subscriber.record_follows_from(span, follows)
@ -131,36 +148,43 @@ impl Dispatch {
/// Returns true if a span with the specified [metadata] would be /// Returns true if a span with the specified [metadata] would be
/// recorded. /// recorded.
/// ///
/// This calls the [`enabled`](::Subscriber::enabled) function on /// This calls the [`enabled`] function on the [`Subscriber`] that this
/// the `Subscriber` that this `Dispatch` forwards to. /// `Dispatch` forwards to.
/// ///
/// [metadata]: ::Metadata /// [metadata]: ../metadata/struct.Metadata.html
/// [`Subscriber`]: ../subscriber/trait.Subscriber.html
/// [`enabled`]: ../subscriber/trait.Subscriber.html#method.enabled
#[inline] #[inline]
pub fn enabled(&self, metadata: &Metadata) -> bool { pub fn enabled(&self, metadata: &Metadata) -> bool {
self.subscriber.enabled(metadata) self.subscriber.enabled(metadata)
} }
/// Visits that an [`Event`] has occurred. /// Records that an [`Event`] has occurred.
/// ///
/// This calls the [`event`](::Subscriber::event) function on /// This calls the [`event`] function on the [`Subscriber`] that this
/// the `Subscriber` that this `Dispatch` forwards to. /// `Dispatch` forwards to.
/// ///
/// [`Event`]: ::event::Event /// [`Event`]: ../event/struct.Event.html
/// [`Subscriber`]: ../subscriber/trait.Subscriber.html
/// [`event`]: ../subscriber/trait.Subscriber.html#method.event
#[inline] #[inline]
pub fn event(&self, event: &Event) { pub fn event(&self, event: &Event) {
self.subscriber.event(event) self.subscriber.event(event)
} }
/// Visits that a span has been entered. /// Records that a span has been entered.
/// ///
/// This calls the [`enter`](::Subscriber::enter) function on the /// This calls the [`enter`] function on the [`Subscriber`] that this
/// `Subscriber` that this `Dispatch` forwards to. /// `Dispatch` forwards to.
///
/// [`Subscriber`]: ../subscriber/trait.Subscriber.html
/// [`event`]: ../subscriber/trait.Subscriber.html#method.event
#[inline] #[inline]
pub fn enter(&self, span: &span::Id) { pub fn enter(&self, span: &span::Id) {
self.subscriber.enter(span) self.subscriber.enter(span)
} }
/// Visits that a span has been exited. /// Records that a span has been exited.
/// ///
/// This calls the [`exit`](::Subscriber::exit) function on the `Subscriber` /// This calls the [`exit`](::Subscriber::exit) function on the `Subscriber`
/// that this `Dispatch` forwards to. /// that this `Dispatch` forwards to.
@ -172,26 +196,32 @@ impl Dispatch {
/// Notifies the subscriber that a [span ID] has been cloned. /// Notifies the subscriber that a [span ID] has been cloned.
/// ///
/// This function is guaranteed to only be called with span IDs that were /// This function is guaranteed to only be called with span IDs that were
/// returned by this `Dispatch`'s `new_span` function. /// returned by this `Dispatch`'s [`new_span`] function.
/// ///
/// This calls the [`clone_span`](::Subscriber::clone_span) function on /// This calls the [`clone_span`] function on the `Subscriber` that this
/// the `Subscriber` that this `Dispatch` forwards to. /// `Dispatch` forwards to.
/// ///
/// [span ID]: ../span/struct.Id.html /// [span ID]: ../span/struct.Id.html
/// [`Subscriber`]: ../subscriber/trait.Subscriber.html
/// [`clone_span`]: ../subscriber/trait.Subscriber.html#method.clone_span
/// [`new_span`]: ../subscriber/trait.Subscriber.html#method.new_span
#[inline] #[inline]
pub fn clone_span(&self, id: &span::Id) -> span::Id { pub fn clone_span(&self, id: &span::Id) -> span::Id {
self.subscriber.clone_span(&id) self.subscriber.clone_span(&id)
} }
/// Notifies the subscriber that a [span ID] handle has been dropped. /// Notifies the subscriber that a [span ID] has been dropped.
/// ///
/// This function is guaranteed to only be called with span IDs that were /// This function is guaranteed to only be called with span IDs that were
/// returned by this `Dispatch`'s `new_span` function. /// returned by this `Dispatch`'s [`new_span`] function.
/// ///
/// This calls the [`drop_span`](::Subscriber::drop_span) function on /// This calls the [`drop_span`] function on the [`Subscriber`] that this
/// the `Subscriber` that this `Dispatch` forwards to. /// `Dispatch` forwards to.
/// ///
/// [span ID]: ../span/struct.Id.html /// [span ID]: ../span/struct.Id.html
/// [`Subscriber`]: ../subscriber/trait.Subscriber.html
/// [`clone_span`]: ../subscriber/trait.Subscriber.html#method.clone_span
/// [`new_span`]: ../subscriber/trait.Subscriber.html#method.new_span
#[inline] #[inline]
pub fn drop_span(&self, id: span::Id) { pub fn drop_span(&self, id: span::Id) {
self.subscriber.drop_span(id) self.subscriber.drop_span(id)

View File

@ -6,16 +6,17 @@ use {field, Metadata};
/// ///
/// An `Event` can be compared to a log record in unstructured logging, but with /// An `Event` can be compared to a log record in unstructured logging, but with
/// two key differences: /// two key differences:
/// - `Event`s exist _within the context of a [`Span`]_. Unlike log lines, they /// - `Event`s exist _within the context of a [span]_. Unlike log lines, they
/// may be located within the trace tree, allowing visibility into the /// may be located within the trace tree, allowing visibility into the
/// _temporal_ context in which the event occurred, as well as the source /// _temporal_ context in which the event occurred, as well as the source
/// code location. /// code location.
/// - Like spans, `Event`s have structured key-value data known as _fields_, /// - Like spans, `Event`s have structured key-value data known as _[fields]_,
/// which may include textual message. In general, a majority of the data /// which may include textual message. In general, a majority of the data
/// associated with an event should be in the event's fields rather than in /// associated with an event should be in the event's fields rather than in
/// the textual message, as the fields are more structed. /// the textual message, as the fields are more structed.
/// ///
/// [`Span`]: ::span::Span /// [span]: ../span
/// [fields]: ../field
#[derive(Debug)] #[derive(Debug)]
pub struct Event<'a> { pub struct Event<'a> {
fields: &'a field::ValueSet<'a>, fields: &'a field::ValueSet<'a>,
@ -35,20 +36,20 @@ impl<'a> Event<'a> {
/// Visits all the fields on this `Event` with the specified [visitor]. /// Visits all the fields on this `Event` with the specified [visitor].
/// ///
/// [visitor]: ::field::Visit /// [visitor]: ../field/trait.Visit.html
#[inline] #[inline]
pub fn record(&self, visitor: &mut field::Visit) { pub fn record(&self, visitor: &mut field::Visit) {
self.fields.record(visitor); self.fields.record(visitor);
} }
/// Returns a reference to the set of values on this `Event`. /// Returns an iterator over the set of values on this `Event`.
pub fn fields(&self) -> field::Iter { pub fn fields(&self) -> field::Iter {
self.fields.field_set().iter() self.fields.field_set().iter()
} }
/// Returns [metadata] describing this `Event`. /// Returns [metadata] describing this `Event`.
/// ///
/// [metadata]: ::metadata::Metadata /// [metadata]: ../metadata/struct.Metadata.html
pub fn metadata(&self) -> &Metadata { pub fn metadata(&self) -> &Metadata {
self.metadata self.metadata
} }

View File

@ -1,36 +1,42 @@
//! `Span` and `Event` key-value data. //! Span and `Event` key-value data.
//! //!
//! Spans and events may be annotated with key-value data, referred to as known //! Spans and events may be annotated with key-value data, referred to as known
//! as _fields_. These fields consist of a mapping from a key (corresponding to //! as _fields_. These fields consist of a mapping from a key (corresponding to
//! a `&str` but represented internally as an array index) to a `Value`. //! a `&str` but represented internally as an array index) to a [`Value`].
//! //!
//! # `Value`s and `Subscriber`s //! # `Value`s and `Subscriber`s
//! //!
//! `Subscriber`s consume `Value`s as fields attached to `Span`s or `Event`s. //! `Subscriber`s consume `Value`s as fields attached to [span]s or [`Event`]s.
//! The set of field keys on a given `Span` or is defined on its `Metadata`. //! The set of field keys on a given span or is defined on its [`Metadata`].
//! When a `Span` is created, it provides a `ValueSet` to the `Subscriber`'s //! When a span is created, it provides [`Attributes`] to the `Subscriber`'s
//! [`new_span`] method, containing any fields whose values were provided when //! [`new_span`] method, containing any fields whose values were provided when
//! the span was created; and may call the `Subscriber`'s [`record`] method //! the span was created; and may call the `Subscriber`'s [`record`] method
//! with additional `ValueSet`s if values are added for more of its fields. //! with additional [`Record`]s if values are added for more of its fields.
//! Similarly, the [`Event`] type passed to the subscriber's [`event`] method //! Similarly, the [`Event`] type passed to the subscriber's [`event`] method
//! will contain any fields attached to each event. //! will contain any fields attached to each event.
//! //!
//! `tokio_trace` represents values as either one of a set of Rust primitives //! `tokio_trace` represents values as either one of a set of Rust primitives
//! (`i64`, `u64`, `bool`, and `&str`) or using a `fmt::Display` or `fmt::Debug` //! (`i64`, `u64`, `bool`, and `&str`) or using a `fmt::Display` or `fmt::Debug`
//! implementation. The `record_` trait functions on the `Subscriber` trait //! implementation. The [`record`] trait method on the `Subscriber` trait
//! allow `Subscriber` implementations to provide type-specific behaviour for //! allow `Subscriber` implementations to provide type-specific behaviour for
//! consuming values of each type. //! consuming values of each type.
//! //!
//! Instances of the `Visit` trait are provided by `Subscriber`s to record the //! Instances of the [`Visit`] trait are provided by `Subscriber`s to record the
//! values attached to `Span`s and `Event`. This trait represents the behavior //! values attached to spans and `Event`. This trait represents the behavior
//! used to record values of various types. For example, we might record //! used to record values of various types. For example, we might record
//! integers by incrementing counters for their field names, rather than printing //! integers by incrementing counters for their field names, rather than printing
//! them. //! them.
//! //!
//! [`new_span`]: ::subscriber::Subscriber::new_span //! [`Value`]: trait.Value.html
//! [`record`]: ::subscriber::Subscriber::record //! [span]: ../span/
//! [`Event`]: ::event::Event //! [`Event`]: ../event/struct.Event.html
//! [`event`]: ::subscriber::Subscriber::event //! [`Metadata`]: ../metadata/struct.Metadata.html
//! [`Attributes`]: ../span/struct.Attributes.html
//! [`Record`]: ../span/struct.Record.html
//! [`new_span`]: ../subscriber/trait.Subscriber.html#method.new_span
//! [`record`]: ../subscriber/trait.Subscriber.html#method.record
//! [`event`]: ../subscriber/trait.Subscriber.html#method.record
//! [`Visit`]: trait.Visit.html
use callsite; use callsite;
use std::{ use std::{
borrow::Borrow, borrow::Borrow,
@ -169,13 +175,13 @@ pub struct Iter {
/// `examples/counters.rs`, which demonstrates a very simple metrics system /// `examples/counters.rs`, which demonstrates a very simple metrics system
/// implemented using `tokio-trace`. /// implemented using `tokio-trace`.
/// ///
/// [`Value`]: ::field::Value /// [`Value`]: trait.Value.html
/// [recorded]: ::field::Value::record /// [recorded]: trait.Value.html#method.record
/// [`Subscriber`]: ::subscriber::Subscriber /// [`Subscriber`]: ../subscriber/trait.Subscriber.html
/// [records an `Event`]: ::subscriber::Subscriber::event /// [records an `Event`]: ../subscriber/trait.Subscriber.html#method.event
/// [set of `Value`s added to a `Span`]: ::subscriber::Subscriber::record /// [set of `Value`s added to a `Span`]: ../subscriber/trait.Subscriber.html#method.record
/// [`Event`]: ::event::Event /// [`Event`]: ../event/struct.Event.html
/// [`ValueSet`]: ::field::ValueSet /// [`ValueSet`]: struct.ValueSet.html
pub trait Visit { pub trait Visit {
/// Visit a signed 64-bit integer value. /// Visit a signed 64-bit integer value.
fn record_i64(&mut self, field: &Field, value: i64) { fn record_i64(&mut self, field: &Field, value: i64) {
@ -207,7 +213,7 @@ pub trait Visit {
/// the [visitor] passed to their `record` method in order to indicate how /// the [visitor] passed to their `record` method in order to indicate how
/// their data should be recorded. /// their data should be recorded.
/// ///
/// [visitor]: ::field::Visit /// [visitor]: trait.Visit.html
pub trait Value: ::sealed::Sealed { pub trait Value: ::sealed::Sealed {
/// Visits this value with the given `Visitor`. /// Visits this value with the given `Visitor`.
fn record(&self, key: &Field, visitor: &mut Visit); fn record(&self, key: &Field, visitor: &mut Visit);
@ -377,8 +383,11 @@ where
// ===== impl Field ===== // ===== impl Field =====
impl Field { impl Field {
/// Returns an [`Identifier`](::metadata::Identifier) that uniquely /// Returns an [`Identifier`] that uniquely identifies the [`Callsite`]
/// identifies the callsite that defines the field this key refers to. /// which defines this field.
///
/// [`Identifier`]: ../callsite/struct.Identifier.html
/// [`Callsite`]: ../callsite/trait.Callsite.html
#[inline] #[inline]
pub fn callsite(&self) -> callsite::Identifier { pub fn callsite(&self) -> callsite::Identifier {
self.fields.callsite() self.fields.callsite()
@ -435,12 +444,18 @@ impl Clone for Field {
// ===== impl FieldSet ===== // ===== impl FieldSet =====
impl FieldSet { impl FieldSet {
/// Returns an [`Identifier`] that uniquely identifies the [`Callsite`]
/// which defines this set of fields..
///
/// [`Identifier`]: ../callsite/struct.Identifier.html
/// [`Callsite`]: ../callsite/trait.Callsite.html
pub(crate) fn callsite(&self) -> callsite::Identifier { pub(crate) fn callsite(&self) -> callsite::Identifier {
callsite::Identifier(self.callsite.0) callsite::Identifier(self.callsite.0)
} }
/// Returns the [`Field`](::field::Field) named `name`, or `None` if no such /// Returns the [`Field`] named `name`, or `None` if no such field exists.
/// field exists. ///
/// [`Field`]: ../struct.Field.html
pub fn field<Q: ?Sized>(&self, name: &Q) -> Option<Field> pub fn field<Q: ?Sized>(&self, name: &Q) -> Option<Field>
where where
Q: Borrow<str>, Q: Borrow<str>,
@ -537,8 +552,11 @@ impl Iterator for Iter {
// ===== impl ValueSet ===== // ===== impl ValueSet =====
impl<'a> ValueSet<'a> { impl<'a> ValueSet<'a> {
/// Returns an [`Identifier`](::metadata::Identifier) that uniquely /// Returns an [`Identifier`] that uniquely identifies the [`Callsite`]
/// identifies the callsite that defines the fields this `ValueSet` refers to. /// defining the fields this `ValueSet` refers to.
///
/// [`Identifier`]: ../callsite/struct.Identifier.html
/// [`Callsite`]: ../callsite/trait.Callsite.html
#[inline] #[inline]
pub fn callsite(&self) -> callsite::Identifier { pub fn callsite(&self) -> callsite::Identifier {
self.fields.callsite() self.fields.callsite()
@ -546,7 +564,7 @@ impl<'a> ValueSet<'a> {
/// Visits all the fields in this `ValueSet` with the provided [visitor]. /// Visits all the fields in this `ValueSet` with the provided [visitor].
/// ///
/// [visitor]: ::field::Visit /// [visitor]: ../trait.Visit.html
pub(crate) fn record(&self, visitor: &mut Visit) { pub(crate) fn record(&self, visitor: &mut Visit) {
let my_callsite = self.callsite(); let my_callsite = self.callsite();
for (field, value) in self.values { for (field, value) in self.values {

View File

@ -78,9 +78,9 @@ extern crate lazy_static;
/// # } /// # }
/// ``` /// ```
/// ///
/// [`Identifier`]: ::callsite::Identifier /// [`Identifier`]: callsite/struct.Identifier.html
/// [`Callsite`]: ::callsite::Callsite /// [`Callsite`]: callsite/trait.Callsite.html
/// [`Callsite::id`]: ::callsite::Callsite::id /// [`Callsite`]: callsite/trait.Callsite.html#method.id
#[macro_export] #[macro_export]
macro_rules! identify_callsite { macro_rules! identify_callsite {
($callsite:expr) => { ($callsite:expr) => {
@ -121,8 +121,8 @@ macro_rules! identify_callsite {
/// # } /// # }
/// ``` /// ```
/// ///
/// [metadata]: ::metadata::Metadata /// [metadata]: metadata/struct.Metadata.html
/// [`Metadata::new`]: ::metadata::Metadata::new /// [`Metadata::new`]: metadata/struct.Metadata.html#method.new
#[macro_export] #[macro_export]
macro_rules! metadata { macro_rules! metadata {
( (

View File

@ -5,7 +5,7 @@ use super::{
}; };
use std::fmt; use std::fmt;
/// Metadata describing a [`Span`]. /// Metadata describing a [span] or [event].
/// ///
/// This includes the source code location where the span occurred, the names of /// This includes the source code location where the span occurred, the names of
/// its fields, et cetera. /// its fields, et cetera.
@ -25,10 +25,10 @@ use std::fmt;
/// originated. This can be used for determining if two Metadata correspond to /// originated. This can be used for determining if two Metadata correspond to
/// the same callsite. /// the same callsite.
/// ///
/// [`Span`]: ::span::Span /// [span]: ../span
/// [`Subscriber`]: ::Subscriber /// [`Subscriber`]: ../subscriber/trait.Subscriber.html
/// [`Metadata::id()`]: ::metadata::Metadata::id /// [`Metadata::id()`]: struct.Metadata.html#method.id
/// [callsite identifier]: ::callsite::Identifier /// [callsite identifier]: ../callsite/struct.Identifier.html
// TODO: When `const fn` is stable, make this type's fields private. // TODO: When `const fn` is stable, make this type's fields private.
pub struct Metadata<'a> { pub struct Metadata<'a> {
/// The name of the span described by this metadata. /// The name of the span described by this metadata.

View File

@ -4,10 +4,13 @@ use {field, Metadata};
/// Identifies a span within the context of a subscriber. /// Identifies a span within the context of a subscriber.
/// ///
/// They are generated by [`Subscriber`](::Subscriber)s for each span as it is /// They are generated by [`Subscriber`]s for each span as it is created, by
/// created, by the [`new_span`](::Subscriber::new_span) trait /// the [`new_span`] trait method. See the documentation for that method for
/// method. See the documentation for that method for more information on span /// more information on span
/// ID generation. /// ID generation.
///
/// [`Subscriber`]: ../subscriber/trait.Subscriber.html
/// [`new_span`]: ../subscriber/trait.Subscriber.html#method.new_span
#[derive(Clone, Debug, PartialEq, Eq, Hash)] #[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct Id(u64); pub struct Id(u64);
@ -134,7 +137,7 @@ impl<'a> Attributes<'a> {
/// Records all the fields in this set of `Attributes` with the provided /// Records all the fields in this set of `Attributes` with the provided
/// [Visitor]. /// [Visitor].
/// ///
/// [visitor]: ::field::Visit /// [visitor]: ../field/trait.Visit.html
pub fn record(&self, visitor: &mut field::Visit) { pub fn record(&self, visitor: &mut field::Visit) {
self.values.record(visitor) self.values.record(visitor)
} }
@ -161,7 +164,7 @@ impl<'a> Record<'a> {
/// Records all the fields in this `Record` with the provided [Visitor]. /// Records all the fields in this `Record` with the provided [Visitor].
/// ///
/// [visitor]: ::field::Visit /// [visitor]: ../field/trait.Visit.html
pub fn record(&self, visitor: &mut field::Visit) { pub fn record(&self, visitor: &mut field::Visit) {
self.values.record(visitor) self.values.record(visitor)
} }

View File

@ -31,8 +31,8 @@ use {span, Event, Metadata};
/// not be needed by the implementations of `enter` and `exit`, the subscriber /// not be needed by the implementations of `enter` and `exit`, the subscriber
/// may freely discard that data without allocating space to store it. /// may freely discard that data without allocating space to store it.
/// ///
/// [ID]: ::span::Span /// [ID]: ../span/struct.Id.html
/// [`new_span`]: ::Span::new_span /// [`new_span`]: trait.Subscriber.html#method.new_span
pub trait Subscriber: 'static { pub trait Subscriber: 'static {
// === Span registry methods ============================================== // === Span registry methods ==============================================
@ -51,7 +51,7 @@ pub trait Subscriber: 'static {
/// preallocate storage for that callsite, or perform any other actions it /// preallocate storage for that callsite, or perform any other actions it
/// wishes to perform once for each callsite. /// wishes to perform once for each callsite.
/// ///
/// The subscriber should then return an [`Interest`](Interest), indicating /// The subscriber should then return an [`Interest`], indicating
/// whether it is interested in being notified about that callsite in the /// whether it is interested in being notified about that callsite in the
/// future. This may be `Always` indicating that the subscriber always /// future. This may be `Always` indicating that the subscriber always
/// wishes to be notified about the callsite, and its filter need not be /// wishes to be notified about the callsite, and its filter need not be
@ -88,8 +88,9 @@ pub trait Subscriber: 'static {
/// callsite, it _may_ still see spans and events originating from that /// callsite, it _may_ still see spans and events originating from that
/// callsite, if another subscriber expressed interest in it. /// callsite, if another subscriber expressed interest in it.
/// ///
/// [metadata]: ::Metadata /// [metadata]: ../metadata/struct.Metadata.html
/// [`enabled`]: ::Subscriber::enabled /// [`Interest`]: struct.Interest.html
/// [`enabled`]: #method.enabled
fn register_callsite(&self, metadata: &Metadata) -> Interest { fn register_callsite(&self, metadata: &Metadata) -> Interest {
match self.enabled(metadata) { match self.enabled(metadata) {
true => Interest::always(), true => Interest::always(),
@ -103,15 +104,15 @@ pub trait Subscriber: 'static {
/// This is used by the dispatcher to avoid allocating for span construction /// This is used by the dispatcher to avoid allocating for span construction
/// if the span would be discarded anyway. /// if the span would be discarded anyway.
/// ///
/// [metadata]: ::Metadata /// [metadata]: ../metadata/struct.Metadata.html
fn enabled(&self, metadata: &Metadata) -> bool; fn enabled(&self, metadata: &Metadata) -> bool;
/// Visit the construction of a new span, returning a new [span ID] for the /// Visit the construction of a new span, returning a new [span ID] for the
/// span being constructed. /// span being constructed.
/// ///
/// The provided `ValueSet` contains any field values that were provided /// The provided [`Attributes`] contains any field values that were provided
/// when the span was created. The subscriber may pass a [visitor] to the /// when the span was created. The subscriber may pass a [visitor] to the
/// `ValueSet`'s [`record` method] to record these values. /// `Attributes`' [`record` method] to record these values.
/// ///
/// IDs are used to uniquely identify spans and events within the context of a /// IDs are used to uniquely identify spans and events within the context of a
/// subscriber, so span equality will be based on the returned ID. Thus, if /// subscriber, so span equality will be based on the returned ID. Thus, if
@ -123,8 +124,9 @@ pub trait Subscriber: 'static {
/// the metadata. /// the metadata.
/// ///
/// [span ID]: ../span/struct.Id.html /// [span ID]: ../span/struct.Id.html
/// [visitor]: ::field::Visit /// [`Attributes`]: ../span/struct.Attributes.html
/// [`record` method]: ::field::ValueSet::record /// [visitor]: ../field/trait.Visit.html
/// [`record` method]: ../span/struct.Attributes.html#method.record
fn new_span(&self, span: &span::Attributes) -> span::Id; fn new_span(&self, span: &span::Attributes) -> span::Id;
// === Notification methods =============================================== // === Notification methods ===============================================
@ -134,8 +136,8 @@ pub trait Subscriber: 'static {
/// The subscriber is expected to provide a [visitor] to the `Record`'s /// The subscriber is expected to provide a [visitor] to the `Record`'s
/// [`record` method] in order to record the added values. /// [`record` method] in order to record the added values.
/// ///
/// [visitor]: ::field::Visit /// [visitor]: ../field/trait.Visit.html
/// [`record` method]: ::span::Record::record /// [`record` method]: ../span/struct.Record.html#method.record
fn record(&self, span: &span::Id, values: &span::Record); fn record(&self, span: &span::Id, values: &span::Record);
/// Adds an indication that `span` follows from the span with the id /// Adds an indication that `span` follows from the span with the id
@ -164,9 +166,9 @@ pub trait Subscriber: 'static {
/// event. The subscriber may pass a [visitor] to the `Event`'s /// event. The subscriber may pass a [visitor] to the `Event`'s
/// [`record` method] to record these values. /// [`record` method] to record these values.
/// ///
/// [`Event`]: ::event::Event /// [`Event`]: ../event/struct.Event.html
/// [visitor]: ::field::Visit /// [visitor]: ../field/trait.Visit.html
/// [`record` method]: ::event::Event::record /// [`record` method]: ../event/struct.Event.html#method.record
fn event(&self, event: &Event); fn event(&self, event: &Event);
/// Visits that a spanhas been entered. /// Visits that a spanhas been entered.
@ -210,7 +212,7 @@ pub trait Subscriber: 'static {
/// what that means for the specified pointer. /// what that means for the specified pointer.
/// ///
/// [span ID]: ../span/struct.Id.html /// [span ID]: ../span/struct.Id.html
/// [`drop_span`]: ::subscriber::Subscriber::drop_span /// [`drop_span`]: trait.Subscriber.html#method.drop_span
fn clone_span(&self, id: &span::Id) -> span::Id { fn clone_span(&self, id: &span::Id) -> span::Id {
id.clone() id.clone()
} }
@ -236,7 +238,7 @@ pub trait Subscriber: 'static {
/// was dropped due to a thread unwinding. /// was dropped due to a thread unwinding.
/// ///
/// [span ID]: ../span/struct.Id.html /// [span ID]: ../span/struct.Id.html
/// [`drop_span`]: ::subscriber::Subscriber::drop_span /// [`clone_span`]: trait.Subscriber.html#method.clone_span
fn drop_span(&self, id: span::Id) { fn drop_span(&self, id: span::Id) {
let _ = id; let _ = id;
} }