summaryrefslogtreecommitdiffstats
path: root/src/service/tcp.rs
diff options
context:
space:
mode:
authorToby Vincent <tobyv@tobyvin.dev>2024-09-27 12:16:23 -0500
committerToby Vincent <tobyv@tobyvin.dev>2024-09-27 12:16:23 -0500
commit1218705fd52771a902eb6c64762623d0c6a13173 (patch)
treeafdded96bff04b8e22704e54dedff5bf78e28229 /src/service/tcp.rs
parentfd992d7e3c03f37fbcafe9d3f26c72a2ead3b2a7 (diff)
refactor: merge Check into Status type
Diffstat (limited to 'src/service/tcp.rs')
-rw-r--r--src/service/tcp.rs9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/service/tcp.rs b/src/service/tcp.rs
index 5f55091..87e696a 100644
--- a/src/service/tcp.rs
+++ b/src/service/tcp.rs
@@ -2,7 +2,7 @@ use std::fmt::Display;
use serde::Deserialize;
-use crate::{Check, Error, Status};
+use crate::{Error, Status};
#[derive(Debug, Clone, Deserialize)]
pub struct Tcp {
@@ -16,13 +16,10 @@ impl Display for Tcp {
}
impl Tcp {
- pub async fn check(&self) -> Result<Check, Error> {
+ pub async fn check(&self) -> Result<Status, Error> {
Ok(std::net::TcpStream::connect(&self.address)
.err()
- .map(|err| Check {
- status: Status::Fail,
- output: Some(format!("error: {err}")),
- })
+ .map(Into::into)
.unwrap_or_default())
}
}