pub struct Error { /* private fields */ }
Implementations§
Source§impl Error
impl Error
Sourcepub fn new<E: Into<Box<dyn Error + Send + Sync>>>(
kind: ErrorKind,
error: Option<E>,
) -> Self
pub fn new<E: Into<Box<dyn Error + Send + Sync>>>( kind: ErrorKind, error: Option<E>, ) -> Self
Create a new error.
If this error was caused by another error, specify it as Some(error)
.
Sourcepub fn new_simple(kind: ErrorKind) -> Self
pub fn new_simple(kind: ErrorKind) -> Self
Create a new error without wrapping any other error.
Sourcepub fn from_message<M: Into<String>>(kind: ErrorKind, msg: M) -> Self
pub fn from_message<M: Into<String>>(kind: ErrorKind, msg: M) -> Self
Create a new error without wrapping any other error.
Sourcepub fn io_kind(&self) -> ErrorKind
pub fn io_kind(&self) -> ErrorKind
Return the kind of this error when converted into an io::Error
.
If the internal error is an io::Error
, returns its kind; otherwise, returns the kind it
would have if it were converted into an io::Error
.
Sourcepub fn fatal(&self) -> bool
pub fn fatal(&self) -> bool
Indicate whether this error is considered fatal.
An error is fatal if it results in an exit of 2 or higher. A missing revision is not considered fatal, but other errors are.
Sourcepub fn exit_status(&self) -> ExitStatus
pub fn exit_status(&self) -> ExitStatus
Return the exit status for this error.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
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
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