Struct Report
pub struct Report<'a>(pub &'a dyn Error);Expand description
A wrapper around an error that provides a cleaned up error trace for display and debug formatting.
Constructed using AsReport::as_report.
§Formatting
The report can be formatted using fmt::Display or fmt::Debug,
which differs based on the alternate flag (#).
-
Without the alternate flag, the error is formatted in a compact way:
Outer error text: Middle error text: Inner error text -
With the alternate flag, the error is formatted in a multi-line format, which is more readable:
Outer error text Caused by these errors (recent errors listed first): 1. Middle error text 2. Inner error text -
Additionally,
fmt::Debugprovide backtraces if available.
§Error source cleaning
It’s common for errors with a source to have a Display
implementation that includes their source text as well:
Outer error text: Middle error text: Inner error textThis works for smaller errors without much detail, but can be annoying when trying to format the error in a more structured way, such as line-by-line:
1. Outer error text: Middle error text: Inner error text
2. Middle error text: Inner error text
3. Inner error textThis iterator compares each pair of errors in the source chain, removing the source error’s text from the containing error’s text:
1. Outer error text
2. Middle error text
3. Inner error textTuple Fields§
§0: &'a dyn ErrorTrait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Report<'a>
impl<'a> !RefUnwindSafe for Report<'a>
impl<'a> !Send for Report<'a>
impl<'a> !Sync for Report<'a>
impl<'a> Unpin for Report<'a>
impl<'a> !UnwindSafe for Report<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Downcast for Twhere
T: AsAny + ?Sized,
impl<T> Downcast for Twhere
T: AsAny + ?Sized,
§fn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
fn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
Any.§fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
Any.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.