1use core::fmt::{Display, Formatter};
2
3pub type Result<T> = core::result::Result<T, Error>;
5
6#[derive(Clone, Debug, Eq, Hash, PartialEq)]
8pub enum Error {
9 StreamNotExhausted(u8),
11 UnexpectedEndOfStream,
13}
14
15impl Display for Error {
16 fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result {
17 match self {
18 Self::StreamNotExhausted(next_byte) => {
19 write!(f, "byte stream not exhausted: [{next_byte:#04X?}, ..]")
20 }
21 Self::UnexpectedEndOfStream => write!(f, "unexpected end of stream"),
22 }
23 }
24}
25
26impl core::error::Error for Error {}