Add kind method
This commit is contained in:
parent
118515ec36
commit
9fbf73ad1b
1 changed files with 9 additions and 0 deletions
|
@ -54,6 +54,15 @@ pub enum Error {
|
||||||
Canceled,
|
Canceled,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Error {
|
||||||
|
pub fn kind(&self) -> Option<io::ErrorKind> {
|
||||||
|
match self {
|
||||||
|
Error::Io(ref io) => Some(io.kind()),
|
||||||
|
_ => None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl From<std::str::Utf8Error> for Error {
|
impl From<std::str::Utf8Error> for Error {
|
||||||
fn from(e: std::str::Utf8Error) -> Self {
|
fn from(e: std::str::Utf8Error) -> Self {
|
||||||
Error::Io(io::Error::new(io::ErrorKind::InvalidInput, e))
|
Error::Io(io::Error::new(io::ErrorKind::InvalidInput, e))
|
||||||
|
|
Loading…
Reference in a new issue