#[repr(transparent)]pub struct Error { /* private fields */ }
Expand description
A generic error capable of representing various error domains (types).
Implementations
Creates an error with supplied error enum variant and message.
Checks if the error domain matches T
.
Tries to convert to a specific error enum.
Returns Some
if the error belongs to the enum’s error domain and
None
otherwise.
Examples
if let Some(file_error) = error.kind::<FileError>() {
match file_error {
FileError::Exist => ...
FileError::Isdir => ...
...
}
}
Returns the error message
Most of the time you can simply print the error since it implements the Display
trait, but you can use this method if you need to have the message as a &str
.
Trait Implementations
Performs the conversion.
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Returns the type identifier of Self
.
Auto Trait Implementations
Blanket Implementations
Mutably borrows from an owned value. Read more
Returns a SendValue
clone of self
.