use std::error;
use std::fmt;
#[derive(PartialEq, Eq, Clone, Copy)]
pub enum ThreadPoolError {
ThreadsLost,
ValueError,
}
impl fmt::Debug for ThreadPoolError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
ThreadPoolError::ThreadsLost => "ThreadPoolError::ThreadsLost".fmt(f),
ThreadPoolError::ValueError => "ThreadPoolError::ValueError".fmt(f),
}
}
}
impl fmt::Display for ThreadPoolError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
ThreadPoolError::ThreadsLost => "thread pool lost".fmt(f),
ThreadPoolError::ValueError => "cannot set thread pool size to 0".fmt(f),
}
}
}
impl error::Error for ThreadPoolError {}