1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#[derive(Debug)]
pub enum ServerError {
Tungstenite(tungstenite::error::Error),
Io(std::io::Error),
}
impl std::fmt::Display for ServerError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::Tungstenite(t) => (&t as &dyn std::fmt::Display).fmt(f),
Self::Io(io) => (&io as &dyn std::fmt::Display).fmt(f),
}
}
}
pub type ServerResult = Result<(), ServerError>;