1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#[cfg(feature = "std")]
use thiserror::Error;
#[derive(Debug, Eq, PartialEq)]
#[cfg_attr(feature = "std", derive(Error))]
pub enum Chip8Error {
#[cfg_attr(feature = "std", error("invalid register {0:?}"))]
InvalidRegister(u8),
#[cfg_attr(feature = "std", error("unknown instruction {0:?}"))]
UnknownInstruction(u16),
#[cfg_attr(feature = "std", error("unimplemented instruction {0:?}"))]
UnimplementedInstruction(crate::instructions::Instruction),
#[cfg_attr(feature = "std", error("invalid key {0:?}"))]
InvalidKey(u8),
#[cfg_attr(feature = "std", error("out of range {0:?}"))]
OutOfRange(u16),
}
pub type Result<T> = core::result::Result<T, Chip8Error>;