pub struct Error<C> { /* private fields */ }
Expand description
The custom error type for use in Result::{Fail, Abort}
.
Stores a wrapped err that must implement Display as well as an offset and
an optional cause.
Implementations§
Source§impl<C> Error<C>
impl<C> Error<C>
Sourcepub fn new<D: Into<String>>(msg: D, ctx: Box<C>) -> Self
pub fn new<D: Into<String>>(msg: D, ctx: Box<C>) -> Self
Constructs a new Error with an offset and no cause.
Sourcepub fn caused_by<'a, D: Into<String>>(
msg: D,
cause: Box<Self>,
ctx: Box<C>,
) -> Self
pub fn caused_by<'a, D: Into<String>>( msg: D, cause: Box<Self>, ctx: Box<C>, ) -> Self
Constructs a new Error with an offset and a cause.
Sourcepub fn get_cause<'a>(&'a self) -> Option<&'a Error<C>>
pub fn get_cause<'a>(&'a self) -> Option<&'a Error<C>>
Returns Some(cause)
if there is one, None otherwise.
pub fn get_context(&self) -> &C
Trait Implementations§
Source§impl<C: Offsetable> Display for Error<C>
impl<C: Offsetable> Display for Error<C>
Source§impl<C: Offsetable + Debug> Error for Error<C>
impl<C: Offsetable + Debug> Error for Error<C>
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Source§impl<C: Offsetable> Offsetable for Error<C>
impl<C: Offsetable> Offsetable for Error<C>
fn get_offset(&self) -> usize
Auto Trait Implementations§
impl<C> Freeze for Error<C>
impl<C> RefUnwindSafe for Error<C>where
C: RefUnwindSafe,
impl<C> Send for Error<C>where
C: Send,
impl<C> Sync for Error<C>where
C: Sync,
impl<C> Unpin for Error<C>
impl<C> UnwindSafe for Error<C>where
C: UnwindSafe,
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
Mutably borrows from an owned value. Read more