use std::fmt;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum HuffmanError {
TooManyBits,
InvalidData,
InputBufferTooSmall,
OutputBufferTooSmall,
InternalInconsistency,
TooManyContexts,
}
impl fmt::Display for HuffmanError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::TooManyBits => write!(f, "too many bits requested"),
Self::InvalidData => write!(f, "invalid huffman data"),
Self::InputBufferTooSmall => write!(f, "input buffer too small"),
Self::OutputBufferTooSmall => write!(f, "output buffer too small"),
Self::InternalInconsistency => write!(f, "internal inconsistency in huffman tree"),
Self::TooManyContexts => write!(f, "too many contexts"),
}
}
}
impl std::error::Error for HuffmanError {}