From 41f6ea196760370d957890113096a5ceba90e3ff Mon Sep 17 00:00:00 2001 From: Szymon Walter Date: Sun, 18 Mar 2018 18:11:58 +0100 Subject: [PATCH] add `error` module --- src/error.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/error.rs diff --git a/src/error.rs b/src/error.rs new file mode 100644 index 0000000..a7caea7 --- /dev/null +++ b/src/error.rs @@ -0,0 +1,22 @@ +/// Wrapper around the raw `ErrorKind` +#[derive(Clone, Debug, PartialEq, Eq, Hash)] +pub struct Error { + kind: ErrorKind, +} + +impl Error { + pub fn from_kind(kind: ErrorKind) -> Error { + Error { kind } + } + + pub fn kind(&self) -> ErrorKind { + self.kind + } +} + +/// The set of all possible errors +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] +pub enum ErrorKind { + BadMagic, + OutOfBounds, +}