Skip to content

Commit

Permalink
doc: Add doc attributes for context_stub
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmah309 committed Sep 18, 2024
1 parent 635c194 commit a95dc17
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ mod sealed {
}

/// For logging a [Result] when an [Err] is encountered.
#[cfg_attr(docsrs, doc(cfg(any(feature = "tracing", feature = "log"))))]
#[cfg_attr(docsrs, doc(cfg(any(feature = "tracing", feature = "log", feature = "context_stub"))))]
pub trait ResultContext<T, E>: sealed::Sealed {
/// Log the context as an "error" if the Result is an [Err].
fn error(self, context: impl Display) -> Result<T, E>;
Expand Down Expand Up @@ -45,7 +45,7 @@ pub trait ResultContext<T, E>: sealed::Sealed {
}

/// For logging a [Result]'s [Err] in the [Debug] format when an [Err] is encountered.
#[cfg_attr(docsrs, doc(cfg(any(feature = "tracing", feature = "log"))))]
#[cfg_attr(docsrs, doc(cfg(any(feature = "tracing", feature = "log", feature = "context_stub"))))]
pub trait ConsumeDebug<T>: sealed::Sealed {
/// Consumes the [Err] of a Result. if [Err], logging as an "error".
fn consume_error(self) -> Option<T>;
Expand All @@ -60,7 +60,7 @@ pub trait ConsumeDebug<T>: sealed::Sealed {
}

/// For logging a [Result]'s [Err] in the [Display] format when an [Err] is encountered.
#[cfg_attr(docsrs, doc(cfg(any(feature = "tracing", feature = "log"))))]
#[cfg_attr(docsrs, doc(cfg(any(feature = "tracing", feature = "log", feature = "context_stub"))))]
pub trait ConsumeDisplay<T>: sealed::Sealed {
/// Consumes the [Err] of a Result. if [Err], logging as an "error".
fn consume_error(self) -> Option<T>;
Expand All @@ -75,7 +75,7 @@ pub trait ConsumeDisplay<T>: sealed::Sealed {
}

/// For logging when a [None] is encountered.
#[cfg_attr(docsrs, doc(cfg(any(feature = "tracing", feature = "log"))))]
#[cfg_attr(docsrs, doc(cfg(any(feature = "tracing", feature = "log", feature = "context_stub"))))]
pub trait OptionContext<T>: sealed::Sealed {
/// Log the context as an "error" if the Option is [None].
fn error(self, context: impl Display) -> Option<T>;
Expand Down

0 comments on commit a95dc17

Please sign in to comment.