pub struct Error { /* private fields */ }Expand description
An error that can possibly inherit from a parent error.
Errors can be enriched with additional information, such as the raw output of a command or a human-friendly explanation.
Implementations§
Source§impl Error
impl Error
pub fn new(description: impl Into<String>) -> Self
pub fn from_source(source: impl Into<Error>) -> Self
pub fn with_source(self, source: impl Into<Error>) -> Self
pub fn with_explanation(self, explanation: impl Into<String>) -> Self
pub fn with_output(self, output: impl Into<String>) -> Self
pub fn description(&self) -> &str
pub fn source(&self) -> Option<&Error>
pub fn explanation(&self) -> Option<&str>
pub fn output(&self) -> Option<&str>
pub fn with_context(self, description: impl Into<String>) -> Self
Trait Implementations§
Source§impl Error for Error
impl Error for Error
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()
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