From 1f94daa8866b2b2f736f0476407da5042befaeb8 Mon Sep 17 00:00:00 2001 From: Mikhail Katychev Date: Tue, 9 Apr 2024 11:32:02 -0500 Subject: [PATCH] inlined --- src/lib.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 530938e..4ca0425 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -459,12 +459,16 @@ impl LogError for Result where E: fmt::Debug, { + #[inline] + #[track_caller] fn log_err(self) { if let Err(e) = self { error!(err = ?e); } } + #[inline] + #[track_caller] fn log_attached_err(self, attachment: A) where A: fmt::Debug + Send + Sync + 'static, @@ -473,6 +477,8 @@ where error!(err = ?e, "{attachment:?}"); } } + #[inline] + #[track_caller] fn and_log(self, level: Level) -> Result { if let Err(err) = &self { match level { @@ -486,6 +492,8 @@ where self } + #[inline] + #[track_caller] fn and_log_err(self) -> Result { if let Err(e) = &self { error!(err = ?e); @@ -493,6 +501,8 @@ where self } + #[inline] + #[track_caller] fn and_attached_err(self, attachment: A) -> Result where A: fmt::Debug + Send + Sync + 'static, @@ -502,6 +512,9 @@ where } self } + + #[inline] + #[track_caller] fn on_err(self, op: impl FnOnce()) -> Result { op(); self