diff options
Diffstat (limited to 'msg_socket2/src/error.rs')
-rw-r--r-- | msg_socket2/src/error.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/msg_socket2/src/error.rs b/msg_socket2/src/error.rs new file mode 100644 index 0000000..902684b --- /dev/null +++ b/msg_socket2/src/error.rs @@ -0,0 +1,23 @@ +#[derive(Debug)] +pub enum Error { + DataError(bincode::Error), + IoError(sys_util::Error), +} + +impl From<bincode::Error> for Error { + fn from(error: bincode::Error) -> Self { + Self::DataError(error) + } +} + +impl From<sys_util::Error> for Error { + fn from(error: sys_util::Error) -> Self { + Self::IoError(error) + } +} + +impl From<std::io::Error> for Error { + fn from(error: std::io::Error) -> Self { + Self::IoError(error.into()) + } +} |