Struct abortable_parser::Error
source · 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)>
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()