summaryrefslogtreecommitdiff
path: root/crates/utils/tcp_connection/src/error.rs
blob: 02f96e3a8902cfad4b132171ab58a5daad172adf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#[derive(Default, Clone, Eq, PartialEq)]
pub struct TcpTargetError {
    msg: String,
}

impl<'a> std::fmt::Display for TcpTargetError {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(f, "{}", self.msg)
    }
}

impl<'a> From<&'a str> for TcpTargetError {
    fn from(value: &'a str) -> Self {
        Self {
            msg: value.to_string(),
        }
    }
}

impl<'a> From<String> for TcpTargetError {
    fn from(value: String) -> Self {
        Self { msg: value }
    }
}