use std::{error::Error as StdError, io, str::Utf8Error};
#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error("io error: {0}")]
Io(io::Error),
#[error("utf8 error: {0}")]
Utf8(Utf8Error),
#[error("stream error: {0}")]
Stream(Box<dyn StdError + Send + Sync>),
#[error("{0}")]
Scan(String),
}
impl From<io::Error> for Error {
fn from(error: io::Error) -> Self {
Self::Io(error)
}
}
impl From<Utf8Error> for Error {
fn from(error: Utf8Error) -> Self {
Self::Utf8(error)
}
}
impl PartialEq for Error {
fn eq(&self, other: &Self) -> bool {
format!("{self}").as_str() == format!("{other}").as_str()
}
}