use crate::*;
impl StdError for ServerError {}
impl Display for ServerError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::UdpBind(data) => write!(f, "UDP bind error: {data}"),
Self::Unknown(data) => write!(f, "Unknown error: {data}"),
Self::UdpRead(data) => write!(f, "UDP read error: {data}"),
Self::Other(data) => write!(f, "Other error: {data}"),
}
}
}
impl StdError for ResponseError {}
impl Display for ResponseError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::SendError(data) => write!(f, "Send error: {data}"),
Self::SocketNotAvailable => write!(f, "Socket not available"),
Self::AddressNotAvailable => write!(f, "Address not available"),
Self::Unknown => write!(f, "Unknown response error"),
}
}
}
impl StdError for RequestError {}
impl Display for RequestError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::ReadError(data) => write!(f, "Read error: {data}"),
Self::BufferTooSmall => write!(f, "Buffer too small"),
Self::Unknown => write!(f, "Unknown request error"),
}
}
}