pub struct Error { /* private fields */ }
Expand description
This crate’s error structure which internal errors are converted into.
The error is split into a general message and a context string. For parsing, for instance, the context string is populated with a snippet of the source text, while for validation the context is populated with a list of errors.
The Error implements both the fmt::Display
and fmt::Debug
traits. It also implements
Implementations§
Source§impl Error
impl Error
Sourcepub fn new<S: Into<String>>(message: S, error_type: Option<ErrorType>) -> Self
pub fn new<S: Into<String>>(message: S, error_type: Option<ErrorType>) -> Self
Create a new Error with only a main message from an input string.
Sourcepub fn new_with_context<S: Into<String>>(
message: S,
location: Option<Location>,
context: S,
error_type: Option<ErrorType>,
) -> Self
pub fn new_with_context<S: Into<String>>( message: S, location: Option<Location>, context: S, error_type: Option<ErrorType>, ) -> Self
Create a new Error with a main message and a context string from two input strings.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
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()
impl Eq for Error
impl StructuralPartialEq for Error
Auto Trait Implementations§
impl Freeze for Error
impl RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnwindSafe for Error
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