use std::io;
#[derive(Error, Debug)]
pub enum SerializationError {
#[error("the last byte does not have enough space to encode the extra info bits")]
NotEnoughSpace,
#[error("the input buffer contained invalid data")]
InvalidData,
#[error("the call expects empty flags")]
UnexpectedFlags,
#[error("IoError: {0}")]
IoError(#[from] io::Error),
#[error(transparent)]
BincodeError(#[from] bincode::Error),
}
impl From<SerializationError> for std::io::Error {
fn from(error: SerializationError) -> Self {
std::io::Error::new(std::io::ErrorKind::Other, format!("{}", error))
}
}