Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: more intra-doc links #2077

Merged
merged 4 commits into from
Apr 19, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions tracing-appender/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,11 @@
//! The [`non_blocking` module][non_blocking]'s documentation provides more detail on how to use `non_blocking`.
//!
//! [non_blocking]: mod@non_blocking
//! [write]: https://doc.rust-lang.org/std/io/trait.Write.html
//! [write]: std::io::Write
//! [guard]: non_blocking::WorkerGuard
//! [rolling]: rolling
//! [make_writer]: https://docs.rs/tracing-subscriber/latest/tracing_subscriber/fmt/trait.MakeWriter.html
//! [make_writer]: tracing_subscriber::fmt::MakeWriter
//! [rolling_struct]: rolling::RollingFileAppender
//! [fmt_subscriber]: https://docs.rs/tracing-subscriber/latest/tracing_subscriber/fmt/struct.Subscriber.html
//! [fmt_subscriber]: tracing_subscriber::fmt::Subscriber
//!
//! ## Non-Blocking Rolling File Appender
//!
Expand Down
5 changes: 2 additions & 3 deletions tracing-appender/src/non_blocking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ pub const DEFAULT_BUFFERED_LINES_LIMIT: usize = 128_000;
/// terminates abruptly (such as through an uncaught `panic` or a `std::process::exit`), some spans
/// or events may not be written.
///
/// [`NonBlocking`]: NonBlocking
/// Since spans/events and events recorded near a crash are often necessary for diagnosing the failure,
/// `WorkerGuard` provides a mechanism to ensure that _all_ buffered logs are flushed to their output.
/// `WorkerGuard` should be assigned in the `main` function or whatever the entrypoint of the program is.
Expand Down Expand Up @@ -121,8 +120,8 @@ pub struct WorkerGuard {
/// crate. Therefore, it can be used with the [`tracing_subscriber::fmt`][fmt] module
/// or with any other subscriber/layer implementation that uses the `MakeWriter` trait.
///
/// [make_writer]: https://docs.rs/tracing-subscriber/latest/tracing_subscriber/fmt/trait.MakeWriter.html
/// [fmt]: https://docs.rs/tracing-subscriber/latest/tracing_subscriber/fmt/index.html
/// [make_writer]: tracing_subscriber::fmt::MakeWriter
/// [fmt]: mod@tracing_subscriber::fmt
#[derive(Clone, Debug)]
pub struct NonBlocking {
error_counter: ErrorCounter,
Expand Down
8 changes: 0 additions & 8 deletions tracing-appender/src/rolling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@
//! will be created daily
//! - [`Rotation::never()`][never()]: This will result in log file located at `some_directory/log_file_name`
//!
//! [minutely]: minutely
//! [hourly]: hourly
//! [daily]: daily
//! [never]: never
//!
//! # Examples
//!
Expand Down Expand Up @@ -126,10 +122,6 @@ impl RollingFileAppender {
/// - [`Rotation::daily()`][daily],
/// - [`Rotation::never()`][never()]
///
/// [minutely]: minutely
/// [hourly]: hourly
/// [daily]: daily
/// [never]: never
///
/// # Examples
/// ```rust
Expand Down
2 changes: 1 addition & 1 deletion tracing-attributes/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ mod expand;
/// [`INFO`]: https://docs.rs/tracing/latest/tracing/struct.Level.html#associatedconstant.INFO
/// [empty field]: https://docs.rs/tracing/latest/tracing/field/struct.Empty.html
/// [field syntax]: https://docs.rs/tracing/latest/tracing/#recording-fields
/// [`fmt::Debug`]: https://doc.rust-lang.org/std/fmt/trait.Debug.html
/// [`fmt::Debug`]: std::fmt::Debug
#[proc_macro_attribute]
pub fn instrument(
args: proc_macro::TokenStream,
Expand Down
8 changes: 1 addition & 7 deletions tracing-core/src/dispatcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,6 @@
//! currently default `Dispatch`. This is used primarily by `tracing`
//! instrumentation.
//!
//! [`Subscriber`]: Subscriber
//! [`with_default`]: with_default
//! [`set_global_default`]: set_global_default
//! [`get_default`]: get_default
//! [`Dispatch`]: Dispatch
use crate::{
callsite, span,
subscriber::{self, NoSubscriber, Subscriber},
Expand All @@ -151,7 +146,6 @@ use crate::stdlib::{

/// `Dispatch` trace data to a [`Subscriber`].
///
/// [`Subscriber`]: Subscriber
#[derive(Clone)]
pub struct Dispatch {
subscriber: Arc<dyn Subscriber + Send + Sync>,
Expand Down Expand Up @@ -579,7 +573,7 @@ impl Dispatch {
/// [`Subscriber`]: super::subscriber::Subscriber
/// [`drop_span`]: super::subscriber::Subscriber::drop_span
/// [`new_span`]: super::subscriber::Subscriber::new_span
/// [`try_close`]: #method.try_close
/// [`try_close`]: Entered::try_close()
#[inline]
#[deprecated(since = "0.1.2", note = "use `Dispatch::try_close` instead")]
pub fn drop_span(&self, id: span::Id) {
Expand Down
4 changes: 0 additions & 4 deletions tracing-core/src/field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@
//! [`record_value`]: Visit::record_value
//! [`record_debug`]: Visit::record_debug
//!
//! [`Value`]: Value
//! [span]: super::span
//! [`Event`]: super::event::Event
//! [`Metadata`]: super::metadata::Metadata
Expand All @@ -110,7 +109,6 @@
//! [`record`]: super::subscriber::Subscriber::record
//! [`event`]: super::subscriber::Subscriber::event
//! [`Value::record`]: Value::record
//! [`Visit`]: Visit
use crate::callsite;
use crate::stdlib::{
borrow::Borrow,
Expand Down Expand Up @@ -249,13 +247,11 @@ pub struct Iter {
/// <code>std::error::Error</code> trait.
/// </pre></div>
///
/// [`Value`]: Value
/// [recorded]: Value::record
/// [`Subscriber`]: super::subscriber::Subscriber
/// [records an `Event`]: super::subscriber::Subscriber::event
/// [set of `Value`s added to a `Span`]: super::subscriber::Subscriber::record
/// [`Event`]: super::event::Event
/// [`ValueSet`]: ValueSet
pub trait Visit {
/// Visits an arbitrary type implementing the [`valuable`] crate's `Valuable` trait.
///
Expand Down
17 changes: 8 additions & 9 deletions tracing-core/src/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ use crate::stdlib::{
///
/// [span]: super::span
/// [event]: super::event
/// [name]: #method.name
/// [target]: #method.target
/// [fields]: #method.fields
/// [verbosity level]: #method.level
/// [file name]: #method.file
/// [line number]: #method.line
/// [module path]: #method.module
/// [name]: Metadata::name()
/// [target]: Metadata::target()
/// [fields]: Metadata::fields()
/// [verbosity level]: Metadata::level()
/// [file name]: Metadata::file()
/// [line number]: Metadata::line()
/// [module path]: Metadata::module_path()
/// [`Subscriber`]: super::subscriber::Subscriber
/// [`id`]: Metadata::id
/// [callsite identifier]: super::callsite::Identifier
Expand Down Expand Up @@ -604,8 +604,7 @@ impl LevelFilter {
/// Returns the most verbose [`Level`] that this filter accepts, or `None`
/// if it is [`OFF`].
///
/// [`Level`]: super::Level
/// [`OFF`]: #associatedconstant.OFF
/// [`OFF`]: LevelFilter::OFF
pub const fn into_level(self) -> Option<Level> {
self.0
}
Expand Down
9 changes: 4 additions & 5 deletions tracing-core/src/span.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ pub struct Record<'a> {
/// - "some", with the current span's [`Id`] and [`Metadata`].
///
/// [the `Subscriber` considers]: super::subscriber::Subscriber::current_span
/// [`Id`]: Id
/// [`Metadata`]: super::metadata::Metadata
#[derive(Debug)]
pub struct Current {
Expand Down Expand Up @@ -73,7 +72,7 @@ impl Id {

/// Constructs a new span ID from the given `NonZeroU64`.
///
/// Unlike [`Id::from_u64`](#method.from_u64), this will never panic.
/// Unlike [`Id::from_u64`](Id::from_u64()), this will never panic.
#[inline]
pub const fn from_non_zero_u64(id: NonZeroU64) -> Self {
Id(id)
Expand Down Expand Up @@ -273,9 +272,9 @@ impl Current {
/// `None`, but in this case, that is because the subscriber does not keep
/// track of the currently-entered span.
///
/// [`id`]: #method.id
/// [`metadata`]: #method.metadata
/// [`into_inner`]: #method.into_inner
/// [`id`]: Current::id()
/// [`metadata`]: Current::metadata()
/// [`into_inner`]: Current::into_inner()
pub fn is_known(&self) -> bool {
!matches!(self.inner, CurrentInner::Unknown)
}
Expand Down
9 changes: 3 additions & 6 deletions tracing-core/src/subscriber.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ use crate::stdlib::{
/// [ID]: super::span::Id
/// [`new_span`]: Subscriber::new_span
/// [`register_callsite`]: Subscriber::register_callsite
/// [`Interest`]: Interest
/// [`enabled`]: Subscriber::enabled
/// [`clone_span`]: Subscriber::clone_span
/// [`try_close`]: Subscriber::try_close
Expand Down Expand Up @@ -136,10 +135,9 @@ pub trait Subscriber: 'static {
/// _may_ still see spans and events originating from that callsite, if
/// another subscriber expressed interest in it.
///
/// [filter]: #method.enabled
/// [filter]: Subscriber::enabled()
/// [metadata]: super::metadata::Metadata
/// [`Interest`]: Interest
/// [`enabled`]: #method.enabled
/// [`enabled`]: Subscriber::enabled()
/// [`rebuild_interest_cache`]: super::callsite::rebuild_interest_cache
fn register_callsite(&self, metadata: &'static Metadata<'static>) -> Interest {
if self.enabled(metadata) {
Expand Down Expand Up @@ -168,7 +166,7 @@ pub trait Subscriber: 'static {
/// [metadata]: super::metadata::Metadata
/// [interested]: Interest
/// [`Interest::sometimes`]: Interest::sometimes
/// [`register_callsite`]: #method.register_callsite
/// [`register_callsite`]: Subscriber::register_callsite()
fn enabled(&self, metadata: &Metadata<'_>) -> bool;

/// Returns the highest [verbosity level][level] that this `Subscriber` will
Expand All @@ -192,7 +190,6 @@ pub trait Subscriber: 'static {
/// level changes.
///
/// [level]: super::Level
/// [`Interest`]: Interest
/// [rebuild]: super::callsite::rebuild_interest_cache
fn max_level_hint(&self) -> Option<LevelFilter> {
None
Expand Down
17 changes: 8 additions & 9 deletions tracing-error/src/backtrace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,13 @@ use tracing::{Metadata, Span};
/// Additionally, if custom formatting is desired, the [`with_spans`] method can
/// be used to visit each span in the trace, formatting them in order.
///
/// [`tracing`]: https://docs.rs/tracing
/// [`Backtrace`]: https://doc.rust-lang.org/std/backtrace/struct.Backtrace.html
/// [span]: https://docs.rs/tracing/latest/tracing/span/index.html
/// [parents]: https://docs.rs/tracing/latest/tracing/span/index.html#span-relationships
/// [fields]: https://docs.rs/tracing/latest/tracing/field/index.html
/// [futures]: https://doc.rust-lang.org/std/future/trait.Future.html
/// [`Backtrace`]: std::backtrace::Backtrace
/// [span]: mod@tracing::span
/// [parents]: mod@tracing::span#span-relationships
/// [fields]: tracing::field
/// [futures]: std::future::Future
/// [`tracing-futures`]: https://docs.rs/tracing-futures/
/// [`with_spans`]: #method.with_spans
/// [`with_spans`]: SpanTrace::with_spans()
#[derive(Clone)]
pub struct SpanTrace {
span: Span,
Expand Down Expand Up @@ -114,8 +113,8 @@ impl SpanTrace {
/// indicate whether to continue iterating over spans; if it returns
/// `false`, no additional spans will be visited.
///
/// [fields]: https://docs.rs/tracing/latest/tracing/field/index.html
/// [`Metadata`]: https://docs.rs/tracing/latest/tracing/struct.Metadata.html
/// [fields]: tracing::field
/// [`Metadata`]: tracing::Metadata
pub fn with_spans(&self, f: impl FnMut(&'static Metadata<'static>, &str) -> bool) {
self.span.with_subscriber(|(id, s)| {
if let Some(getcx) = s.downcast_ref::<WithContext>() {
Expand Down
8 changes: 4 additions & 4 deletions tracing-error/src/layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ use tracing_subscriber::{
/// when formatting the fields of each span in a trace. When no formatter is
/// provided, the [default format] is used instead.
///
/// [`Layer`]: https://docs.rs/tracing-subscriber/0.3/tracing_subscriber/layer/trait.Layer.html
/// [`Layer`]: tracing_subscriber::layer::Layer
/// [`SpanTrace`]: super::SpanTrace
/// [field formatter]: https://docs.rs/tracing-subscriber/0.3/tracing_subscriber/fmt/trait.FormatFields.html
/// [default format]: https://docs.rs/tracing-subscriber/0.3/tracing_subscriber/fmt/format/struct.DefaultFields.html
/// [field formatter]: tracing_subscriber::fmt::FormatFields
/// [default format]: tracing_subscriber::fmt::format::DefaultFields
pub struct ErrorLayer<S, F = DefaultFields> {
format: F,

Expand Down Expand Up @@ -69,7 +69,7 @@ where
{
/// Returns a new `ErrorLayer` with the provided [field formatter].
///
/// [field formatter]: https://docs.rs/tracing-subscriber/0.2.10/tracing_subscriber/fmt/trait.FormatFields.html
/// [field formatter]: tracing_subscriber::fmt::FormatFields
pub fn new(format: F) -> Self {
Self {
format,
Expand Down
17 changes: 5 additions & 12 deletions tracing-error/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,19 +157,12 @@
//! }
//! ```
//!
//! [`SpanTrace`]: SpanTrace
//! [`ErrorLayer`]: ErrorLayer
//! [`TracedError`]: TracedError
//! [`InstrumentResult`]: InstrumentResult
//! [`InstrumentError`]: InstrumentError
//! [`ExtractSpanTrace`]: ExtractSpanTrace
//! [`in_current_span()`]: InstrumentResult#tymethod.in_current_span
//! [span]: https://docs.rs/tracing/latest/tracing/span/index.html
//! [events]: https://docs.rs/tracing/latest/tracing/struct.Event.html
//! [`Subscriber`]: https://docs.rs/tracing/latest/tracing/trait.Subscriber.html
//! [subscriber layer]: https://docs.rs/tracing-subscriber/latest/tracing_subscriber/layer/trait.Layer.html
//! [`tracing`]: https://docs.rs/tracing
//! [`std::error::Error`]: https://doc.rust-lang.org/stable/std/error/trait.Error.html
//! [span]: mod@tracing::span
//! [events]: tracing::Event
//! [`Subscriber`]: tracing::Subscriber
//! [subscriber layer]: tracing_subscriber::layer::Layer
//! [`tracing`]: tracing
//!
//! ## Supported Rust Versions
//!
Expand Down
4 changes: 0 additions & 4 deletions tracing-flame/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,7 @@
//! the execution of your program. This representation is best created with a
//! _flamechart_, which _does not_ sort or collapse identical stack frames.
//!
//! [`tracing`]: https://docs.rs/tracing
//! [`inferno`]: https://docs.rs/inferno
//! [`FlameLayer`]: FlameLayer
//! [`FlushGuard`]: FlushGuard
//! [`inferno-flamegraph`]: https://docs.rs/inferno/0.9.5/inferno/index.html#producing-a-flame-graph
//!
//! ## Supported Rust Versions
Expand Down Expand Up @@ -212,7 +209,6 @@ thread_local! {
/// flush the writer.
///
/// [`flush_on_drop`]: FlameLayer::flush_on_drop
/// [`FlushGuard`]: FlushGuard
#[derive(Debug)]
pub struct FlameLayer<S, W> {
out: Arc<Mutex<W>>,
Expand Down
25 changes: 11 additions & 14 deletions tracing-futures/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,8 @@
//!
//! The `tokio`, `std-future` and `std` features are enabled by default.
//!
//! [`tracing`]: https://crates.io/crates/tracing
//! [span]: https://docs.rs/tracing/latest/tracing/span/index.html
//! [`Subscriber`]: https://docs.rs/tracing/latest/tracing/subscriber/index.html
//! [`Instrument`]: Instrument
//! [`WithSubscriber`]: WithSubscriber
//! [span]: tracing::span!
//! [`Subscriber`]: tracing::subscriber
//! [`futures`]: https://crates.io/crates/futures
//!
//! ## Supported Rust Versions
Expand Down Expand Up @@ -121,7 +118,7 @@ pub mod executor;
/// Extension trait allowing futures, streams, sinks, and executors to be
/// instrumented with a `tracing` [span].
///
/// [span]: https://docs.rs/tracing/latest/tracing/span/index.html
/// [span]: mod@tracing::span
pub trait Instrument: Sized {
/// Instruments this type with the provided `Span`, returning an
/// `Instrumented` wrapper.
Expand Down Expand Up @@ -150,7 +147,7 @@ pub trait Instrument: Sized {
/// # }
/// ```
///
/// [entered]: https://docs.rs/tracing/latest/tracing/span/struct.Span.html#method.enter
/// [entered]: tracing::Span::enter
fn instrument(self, span: Span) -> Instrumented<Self> {
Instrumented { inner: self, span }
}
Expand Down Expand Up @@ -185,8 +182,8 @@ pub trait Instrument: Sized {
/// # }
/// ```
///
/// [current]: https://docs.rs/tracing/latest/tracing/span/struct.Span.html#method.current
/// [entered]: https://docs.rs/tracing/latest/tracing/span/struct.Span.html#method.enter
/// [current]: tracing::Span::current
/// [entered]: tracing::Span::enter
#[inline]
fn in_current_span(self) -> Instrumented<Self> {
self.instrument(Span::current())
Expand All @@ -196,7 +193,7 @@ pub trait Instrument: Sized {
/// Extension trait allowing futures, streams, and sinks to be instrumented with
/// a `tracing` [`Subscriber`].
///
/// [`Subscriber`]: https://docs.rs/tracing/latest/tracing/subscriber/trait.Subscriber.html
/// [`Subscriber`]: tracing::Subscriber
#[cfg(feature = "std")]
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
pub trait WithSubscriber: Sized {
Expand All @@ -208,8 +205,8 @@ pub trait WithSubscriber: Sized {
/// When the wrapped type is an executor, the subscriber will be set as the
/// default for any futures spawned on that executor.
///
/// [`Subscriber`]: https://docs.rs/tracing/latest/tracing/subscriber/trait.Subscriber.html
/// [default]: https://docs.rs/tracing/latest/tracing/dispatcher/index.html#setting-the-default-subscriber
/// [`Subscriber`]: tracing::Subscriber
/// [default]: tracing::dispatcher#setting-the-default-subscriber
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where
S: Into<Dispatch>,
Expand All @@ -231,8 +228,8 @@ pub trait WithSubscriber: Sized {
/// This can be used to propagate the current dispatcher context when
/// spawning a new future.
///
/// [`Subscriber`]: https://docs.rs/tracing/latest/tracing/subscriber/trait.Subscriber.html
/// [default]: https://docs.rs/tracing/latest/tracing/dispatcher/index.html#setting-the-default-subscriber
/// [`Subscriber`]: tracing::Subscriber
/// [default]: tracing::dispatcher#setting-the-default-subscriber
#[inline]
fn with_current_subscriber(self) -> WithDispatch<Self> {
WithDispatch {
Expand Down
Loading