add error
module
This commit is contained in:
parent
568ebd3207
commit
41f6ea1967
22
src/error.rs
Normal file
22
src/error.rs
Normal file
|
@ -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,
|
||||||
|
}
|
Reference in a new issue