diff options
author | Yorhel <git@yorhel.nl> | 2019-04-19 13:26:44 +0200 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2019-04-19 13:26:44 +0200 |
commit | 19f772cd3714c204e2439958ef349c0032a0ff71 (patch) | |
tree | 5ecf4e439cdeb816f28540b60a535d2452a0084d | |
parent | adf4bcb6aeb460e0f243fb0cec2bf4bfea11fc29 (diff) |
impl Error for Error
-rw-r--r-- | src/err.rs | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -37,4 +37,14 @@ impl From<std::io::Error> for Error { } } +impl std::error::Error for Error { + fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { + use ErrorImpl::*; + match &*self.0 { + IO(e) => Some(e), + _ => None + } + } +} + pub type Result<T> = std::result::Result<T,Error>; |