use std::error;
use std::fmt;
#[derive(Debug)]
pub enum DecoderError {
InvalidInput,
BufferOverflow,
InvalidSpeed,
}
impl fmt::Display for DecoderError {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
match self {
Self::InvalidInput => write!(fmt, "Invalid Huffman sequence."),
Self::BufferOverflow => write!(fmt, "Buffer size exceeded."),
Self::InvalidSpeed => write!(fmt, "Speed must be be between 1 and 5."),
}
}
}
impl error::Error for DecoderError {}