hyper 1.13.0

A protective and efficient HTTP library for all.
Documentation
// For completeness, wrappers around all of tracing's public logging and span macros are provided,
// even if they are not used at the present time.
#![allow(unused_macros)]

#[cfg(all(not(hyper_unstable_tracing), feature = "tracing"))]
compile_error!(
    "\
    The `tracing` feature is unstable, and requires the \
    `RUSTFLAGS='--cfg hyper_unstable_tracing'` environment variable to be set.\
"
);

/// A type representing a RAII guard from a disabled tracing span.
///
/// When the `tracing` feature flag is not active we do not enter tracing
/// spans. This type does nothing when dropped, and does not guard any
/// resources.
///
/// This helps avoid expressions that conditionally compile to either `()` or
/// `tracing::span::Entered` depending on which feature flags are enabled.
//
//  This ZST (zero sized type) marker only exists when the tracing flag is not
//  active.
#[cfg(not(feature = "tracing"))]
//  This module allows `unused_macros`. Similarly, we allow dead code in case
//  none of the macros exported by this module are used elsewhere.
#[allow(dead_code)]
//  This type is marked as a `#[must_use]` type not for its own semantic
//  constraints, but to enforce consistency with code paths associated with
//  the `tracing` feature flag.
#[must_use = "once a span has been entered, it should be exited"]
pub(crate) struct Disabled;

macro_rules! debug {
    ($($arg:tt)+) => {
        #[cfg(feature = "tracing")]
        {
            tracing::debug!($($arg)+);
        }
    }
}

macro_rules! debug_span {
    ($($arg:tt)*) => {
        {
            #[cfg(feature = "tracing")]
            {
                let _span = tracing::debug_span!($($arg)+);
                _span.entered()
            }
            #[cfg(not(feature = "tracing"))]
            {
                crate::trace::Disabled
            }
        }
    }
}

macro_rules! error {
    ($($arg:tt)*) => {
        #[cfg(feature = "tracing")]
        {
            tracing::error!($($arg)+);
        }
    }
}

macro_rules! error_span {
    ($($arg:tt)*) => {
        {
            #[cfg(feature = "tracing")]
            {
                let _span = tracing::error_span!($($arg)+);
                _span.entered()
            }
            #[cfg(not(feature = "tracing"))]
            {
                crate::trace::Disabled
            }
        }
    }
}

macro_rules! info {
    ($($arg:tt)*) => {
        #[cfg(feature = "tracing")]
        {
            tracing::info!($($arg)+);
        }
    }
}

macro_rules! info_span {
    ($($arg:tt)*) => {
        {
            #[cfg(feature = "tracing")]
            {
                let _span = tracing::info_span!($($arg)+);
                _span.entered()
            }
            #[cfg(not(feature = "tracing"))]
            {
                crate::trace::Disabled
            }
        }
    }
}

macro_rules! trace {
    ($($arg:tt)*) => {
        #[cfg(feature = "tracing")]
        {
            tracing::trace!($($arg)+);
        }
    }
}

macro_rules! trace_span {
    ($($arg:tt)*) => {
        {
            #[cfg(feature = "tracing")]
            {
                let _span = tracing::trace_span!($($arg)+);
                _span.entered()
            }
            #[cfg(not(feature = "tracing"))]
            {
                crate::trace::Disabled
            }
        }
    }
}

macro_rules! span {
    ($($arg:tt)*) => {
        {
            #[cfg(feature = "tracing")]
            {
                let _span = tracing::span!($($arg)+);
                _span.entered()
            }
        }
    }
}

macro_rules! warn {
    ($($arg:tt)*) => {
        #[cfg(feature = "tracing")]
        {
            tracing::warn!($($arg)+);
        }
    }
}

macro_rules! warn_span {
    ($($arg:tt)*) => {
        {
            #[cfg(feature = "tracing")]
            {
                let _span = tracing::warn_span!($($arg)+);
                _span.entered()
            }
            #[cfg(not(feature = "tracing"))]
            {
                crate::trace::Disabled
            }
        }
    }
}