rustchat/src/chat_error.rs

19 lines
464 B
Rust
Raw Normal View History

2021-12-31 02:05:32 +01:00
#[derive(Debug)]
pub enum ChatError {
IOError(std::io::Error),
MutexPoisonError(),
Protocol(String),
}
impl From<std::io::Error> for ChatError {
fn from(error: std::io::Error) -> Self {
ChatError::IOError(error)
}
}
impl <'a, T> From<std::sync::PoisonError<std::sync::MutexGuard<'a, T>>> for ChatError {
fn from(_error: std::sync::PoisonError<std::sync::MutexGuard<'a, T>>) -> Self {
ChatError::MutexPoisonError()
}
}