Struct Problem

Source
pub struct Problem { /* private fields */ }
Expand description

Wraps error, context and backtrace information and formats it for display. Data is heap allocated to avoid type parameters or lifetimes.

Implementations§

Source§

impl Problem

Source

pub fn from_error(error: impl Into<Box<dyn Error>>) -> Problem

Create Problem from types implementing Into<Box<dyn Error>> (including String and &str) so that Error::cause chain is followed through in the Display message

Source

pub fn from_error_message(error: &impl Error) -> Problem

Same as Problem::from_error but stores only final message as String and does not take ownership of the error

Source

pub fn backtrace(&self) -> Option<&str>

Get backtrace associated with this Problem instance if available

Source

pub fn into_error(self) -> Error

Wraps Problem into type implementing Error trait

Trait Implementations§

Source§

impl Debug for Problem

Source§

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

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

impl Display for Problem

Source§

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

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

impl<E> From<E> for Problem
where E: Into<Box<dyn Error>>,

Every type implementing Into<Box<dyn Error>> trait (including String and &str types) can be converted to Problem via ? operator

Source§

fn from(error: E) -> Problem

Converts to this type from the input type.
Source§

impl From<Problem> for FatalProblem

Source§

fn from(problem: Problem) -> FatalProblem

Converts to this type from the input type.
Source§

impl ProblemWhile for Problem

Source§

type WithContext = Problem

Source§

fn problem_while(self, message: impl ToString) -> Problem

Add context information
Source§

fn problem_while_with<F, M>(self, message: F) -> Problem
where F: FnOnce() -> M, M: ToString,

Add context information from function call

Auto Trait Implementations§

§

impl Freeze for Problem

§

impl !RefUnwindSafe for Problem

§

impl !Send for Problem

§

impl !Sync for Problem

§

impl Unpin for Problem

§

impl !UnwindSafe for Problem

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<!> for T

Source§

fn from(t: !) -> T

Converts to this type from the input type.
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.