Struct StringTracer

Source
pub struct StringTracer(pub String);
Expand description

A naive string tracer serializes error messages into string and simply concatenate them together. This can be used for example in no_std environment, which may not support more complex error tracers.

Tuple Fields§

§0: String

Trait Implementations§

Source§

impl Debug for StringTracer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for StringTracer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl ErrorMessageTracer for StringTracer

Source§

fn new_message<E: Display>(err: &E) -> Self

Creates a new error trace, starting from a source error detail that implements Display.
Source§

fn add_message<E: Display>(self, err: &E) -> Self

Adds new error detail to an existing trace.
Source§

fn as_error(&self) -> Option<&(dyn Error + 'static)>

If the std feature is enabled, the error tracer also provides method to optionally converts itself to a dyn Error.
Source§

impl<E: Display> ErrorTracer<E> for StringTracer

Source§

fn new_trace(err: E) -> Self

Create a new error trace from E, also taking ownership of it. Read more
Source§

fn add_trace(self, err: E) -> Self

Add a new error trace from E. In the current underlying implementation, this is effectively still has the same behavior as ErrorMessageTracer::add_message. This is because eyre and anyhow do not support adding new set of backtraces to an existing trace. So effectively, currently the error tracers can track at most one backtrace coming from the original error source.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.