use std::fmt::Debug;
use std::io;
use crossbeam_channel as crossbeam;
use thiserror::Error;
#[derive(Error, Debug)]
pub enum Error {
#[error("i/o error: {0}")]
Io(#[from] io::Error),
#[error("channel error: {0}")]
Channel(Box<dyn std::error::Error + Send + Sync + 'static>),
}
impl<T: Debug + Send + Sync + 'static> From<crossbeam::SendError<T>> for Error {
fn from(err: crossbeam::SendError<T>) -> Self {
Self::Channel(Box::new(err))
}
}
impl From<crossbeam::RecvError> for Error {
fn from(err: crossbeam::RecvError) -> Self {
Self::Channel(Box::new(err))
}
}
impl From<crossbeam::RecvTimeoutError> for Error {
fn from(err: crossbeam::RecvTimeoutError) -> Self {
Self::Channel(Box::new(err))
}
}