Add kind method
This commit is contained in:
parent
118515ec36
commit
9fbf73ad1b
|
@ -54,6 +54,15 @@ pub enum Error {
|
|||
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 {
|
||||
fn from(e: std::str::Utf8Error) -> Self {
|
||||
Error::Io(io::Error::new(io::ErrorKind::InvalidInput, e))
|
||||
|
|
Loading…
Reference in a new issue