udp_request/request/error/
impl.rs

1use crate::*;
2
3/// Implements the `StdError` trait for `RequestError`.
4impl StdError for RequestError {}
5
6/// Implements the `Display` trait for `RequestError`.
7impl Display for RequestError {
8    /// Formats the `RequestError` for display.
9    ///
10    /// # Arguments
11    ///
12    /// - `&mut fmt::Formatter<'_>` - The formatter to write the output to.
13    ///
14    /// # Returns
15    ///
16    /// - `fmt::Result` - The result of the formatting operation.
17    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
18        match self {
19            Self::InvalidUrl => write!(f, "Invalid url"),
20            Self::UdpSocketCreateError => write!(f, "Udp socket create error"),
21            Self::UdpSocketConnectError => write!(f, "Udp socket connection error"),
22            Self::RequestError => write!(f, "Request error"),
23            Self::ReadConnectionError => write!(f, "Connection read error"),
24            Self::SetReadTimeoutError => write!(f, "Failed to set read timeout"),
25            Self::SetWriteTimeoutError => write!(f, "Failed to set write timeout"),
26            Self::ReadResponseError => write!(f, "Read response error"),
27            Self::SendResponseError(err) => write!(f, "Send response error: {}", err),
28        }
29    }
30}