From 29589fede8af516db787bd0cb1b4f49986feaf8d Mon Sep 17 00:00:00 2001 From: Tom Forbes Date: Sun, 15 Dec 2024 17:01:25 +0000 Subject: [PATCH] Formatting --- Cargo.lock | 40 ---------------------------------------- pinger/Cargo.toml | 2 -- pinger/src/lib.rs | 12 +++++++++++- 3 files changed, 11 insertions(+), 43 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 99d06399..6cff39dd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -310,17 +310,6 @@ dependencies = [ "powerfmt", ] -[[package]] -name = "derive-new" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cdc8d50f426189eef89dac62fabfa0abb27d5cc008f25bf4156a0203325becc" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "diff" version = "0.1.13" @@ -417,15 +406,6 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" -[[package]] -name = "home" -version = "0.5.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" -dependencies = [ - "windows-sys 0.52.0", -] - [[package]] name = "iana-time-zone" version = "0.1.61" @@ -671,13 +651,11 @@ name = "pinger" version = "1.3.0" dependencies = [ "anyhow", - "derive-new", "dns-lookup", "lazy-regex", "os_info", "rand", "thiserror", - "which", "winping", ] @@ -1132,18 +1110,6 @@ version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "943aab3fdaaa029a6e0271b35ea10b72b943135afe9bffca82384098ad0e06a6" -[[package]] -name = "which" -version = "7.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9cad3279ade7346b96e38731a641d7343dd6a53d55083dd54eadfa5a1b38c6b" -dependencies = [ - "either", - "home", - "rustix", - "winsafe", -] - [[package]] name = "winapi" version = "0.3.9" @@ -1344,12 +1310,6 @@ dependencies = [ "winapi_forked_icmpapi", ] -[[package]] -name = "winsafe" -version = "0.0.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d135d17ab770252ad95e9a872d365cf3090e3be864a34ab46f48555993efc904" - [[package]] name = "yansi" version = "1.0.1" diff --git a/pinger/Cargo.toml b/pinger/Cargo.toml index b4bdceb3..c93a2709 100644 --- a/pinger/Cargo.toml +++ b/pinger/Cargo.toml @@ -12,8 +12,6 @@ anyhow = "1.0.94" thiserror = "2.0.7" rand = "0.8.5" lazy-regex = "3.3.0" -derive-new = "0.7.0" -which = "7.0.0" [target.'cfg(windows)'.dependencies] winping = "0.10.1" diff --git a/pinger/src/lib.rs b/pinger/src/lib.rs index 7576343f..231d7e84 100644 --- a/pinger/src/lib.rs +++ b/pinger/src/lib.rs @@ -39,13 +39,23 @@ mod fake; #[cfg(test)] mod test; -#[derive(Debug, Clone, derive_new::new)] +#[derive(Debug, Clone)] pub struct PingOptions { pub target: String, pub interval: Duration, pub interface: Option, } +impl PingOptions { + pub fn new(target: String, interval: Duration, interface: Option) -> Self { + Self { + target, + interval, + interface, + } + } +} + pub fn run_ping( cmd: impl AsRef + Debug, args: Vec + Debug>,