From 1360ee7d91cedf3dd67123ad2fbcdf23415b3a79 Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Sun, 14 Sep 2025 22:41:47 +0800 Subject: Add error.rs --- crates/utils/tcp_connection/src/error.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 crates/utils/tcp_connection/src/error.rs (limited to 'crates') 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 for TcpTargetError { + fn from(value: String) -> Self { + Self { msg: value } + } +} -- cgit