From b292797423875ab62e3d7fb19b57f11dca8c499c Mon Sep 17 00:00:00 2001 From: Jacobtread Date: Thu, 18 Jan 2024 14:40:37 +1300 Subject: [PATCH] feat: add conversion between error types --- src/error.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/error.rs b/src/error.rs index dc86560..6825500 100644 --- a/src/error.rs +++ b/src/error.rs @@ -12,3 +12,13 @@ pub enum Error { /// Result type where errors are of type [Error](enum@Error). pub type Result = StdResult; + +impl From for IoError { + fn from(value: Error) -> Self { + match value { + Error::IO(err) => err, + // If other error types are added in the future: + // err => IoError::new(std::io::ErrorKind::Other, err), + } + } +}