pub fn display_result<T, E>(result: &Result<T, E>) -> DisplayResult<'_, T, E>Expand description
Formats a Result using std::fmt::Display, showing either the value or the full error chain.
On success, displays the value using its std::fmt::Display implementation.
On error, displays <error: {err}: {cause1}: {cause2}...> with the full source chain,
wrapped in angle brackets to indicate an error occurred where a value was expected.
ยงExample
use tempo_telemetry_util::display_result;
let ok_result: Result<u64, std::io::Error> = Ok(42);
let err_result: Result<u64, std::io::Error> = Err(std::io::ErrorKind::NotFound.into());
tracing::warn!(
ok_value = %display_result(&ok_result),
err_value = %display_result(&err_result),
"example log",
);