diff options
| author | 魏曹先生 <1992414357@qq.com> | 2025-09-14 22:41:47 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2025-09-14 22:41:47 +0800 |
| commit | 1360ee7d91cedf3dd67123ad2fbcdf23415b3a79 (patch) | |
| tree | 493f5021b6a0a95d11929844ddcdd464fcc19633 /crates | |
| parent | 0ad594277e61e9fb41b2e470c34cff7534d6c780 (diff) | |
Add error.rs
Diffstat (limited to 'crates')
| -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 } + } +} |
