diff options
Diffstat (limited to 'crates/utils/tcp_connection/src')
| -rw-r--r-- | crates/utils/tcp_connection/src/error.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/crates/utils/tcp_connection/src/error.rs b/crates/utils/tcp_connection/src/error.rs new file mode 100644 index 0000000..02f96e3 --- /dev/null +++ b/crates/utils/tcp_connection/src/error.rs @@ -0,0 +1,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 } + } +} |
