summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2019-04-19 13:26:44 +0200
committerYorhel <git@yorhel.nl>2019-04-19 13:26:44 +0200
commit19f772cd3714c204e2439958ef349c0032a0ff71 (patch)
tree5ecf4e439cdeb816f28540b60a535d2452a0084d
parentadf4bcb6aeb460e0f243fb0cec2bf4bfea11fc29 (diff)
impl Error for Error
-rw-r--r--src/err.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/err.rs b/src/err.rs
index aa39ede..8a5a2c5 100644
--- a/src/err.rs
+++ b/src/err.rs
@@ -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>;