Skip to content

Commit ebeb031

Browse files
committed
docs(trace): add documentation to trace module and new features to feature list
Document `trace` and add new features to the documentation feature list. Modify `package.metadata.docs.rs` in `Cargo.toml` to include `tracing` to list of `features` and `--cfg hyper_unstable_tracing` to the list of `rustdoc-args`.
1 parent bab6597 commit ebeb031

File tree

3 files changed

+34
-2
lines changed

3 files changed

+34
-2
lines changed

Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ tracing = ["dep:tracing"]
9191
nightly = []
9292

9393
[package.metadata.docs.rs]
94-
features = ["ffi", "full"]
95-
rustdoc-args = ["--cfg", "docsrs", "--cfg", "hyper_unstable_ffi"]
94+
features = ["ffi", "full", "tracing"]
95+
rustdoc-args = ["--cfg", "docsrs", "--cfg", "hyper_unstable_ffi", "--cfg", "hyper_unstable_tracing"]
9696

9797
[package.metadata.playground]
9898
features = ["full"]

src/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,11 @@ pub use crate::error::{Error, Result};
6767

6868
#[macro_use]
6969
mod cfg;
70+
7071
#[macro_use]
72+
#[cfg_attr(docsrs, doc(all(feature = "tracing"), hyper_unstable_tracing))]
7173
mod trace;
74+
7275
#[macro_use]
7376
mod common;
7477
pub mod body;

src/trace.rs

+29
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,34 @@
1+
// For completeness, wrappers around all of tracing's public macros are provided, even if they are
2+
// not used at the present time.
13
#![allow(unused_macros)]
24

5+
//! Internal Tracing macro module
6+
//!
7+
//! The [`trace`][crate::trace] module is an internal module that contains wrapper macros encapsulating
8+
//! [`tracing`][tracing]'s macros. These macros allow for conditional expansion of
9+
//! [`tracing`][tracing] macros during compilation when the `tracing` feature is enabled, or trimming
10+
//! them when the feature is disabled, all in a concise manner.
11+
//!
12+
//! The macros from the [`trace`][crate::trace] module are declared by default and can be used throughout the
13+
//! crate. However, as the contents of these macros are conditionally compiled, they are effectively trimmed
14+
//! during inline expansion when the `tracing` feature is disabled.
15+
//!
16+
//! # Unstable
17+
//!
18+
//! The [`tracing`][tracing] module is currenty **unstable**, hence the existence of this module. As a
19+
//! result, hyper's [`tracing`][tracing] logs are only accessibe if `--cfg hyper_unstable_tracing` is
20+
//! passed to `rustc` when compiling. The easiest way to do that is through setting the `RUSTFLAGS`
21+
//! enviornment variable.
22+
//!
23+
//! # Building
24+
//!
25+
//! Enabling [`trace`][crate::trace] logs, can be done with the following `cargo` command, as of
26+
//! version `1.64.0`:
27+
//!
28+
//! ```notrust
29+
//! RUSTFLAGS="--cfg hyper_unstable_tracing" cargo rustc --features client,http1,http2,tracing --crate-type cdylib
30+
//! ```
31+
332
macro_rules! debug {
433
($($arg:tt)+) => {
534
#[cfg(feature = "tracing")]

0 commit comments

Comments
 (0)