]> code.octet-stream.net Git - netwatcher/commitdiff
Fix up deps for Linux
authorThomas Karpiniec <tom.karpiniec@outlook.com>
Sat, 8 Jun 2024 07:39:30 +0000 (17:39 +1000)
committerThomas Karpiniec <tom.karpiniec@outlook.com>
Sat, 8 Jun 2024 07:39:30 +0000 (17:39 +1000)
Cargo.toml
src/lib.rs
src/watch_linux.rs [new file with mode: 0644]

index a1feb3cd76b55ec25addf13197ac4698e52f430a..45cff205d21bf16c5288a7decbff325a7554d008 100644 (file)
@@ -5,8 +5,10 @@ edition = "2021"
 
 [dependencies]
 
-[target.'cfg(target_vendor = "apple")'.dependencies]
+[target.'cfg(any(target_vendor = "apple", target_os = "linux"))'.dependencies]
 nix = { version = "0.29.0", features = ["net"] }
+
+[target.'cfg(target_vendor = "apple")'.dependencies]
 block2 = "0.5.1"
 
 [target.'cfg(windows)'.dependencies.windows]
index 46218d2ceec0469263dd2ca48e61d90402b8af43..e7bf15234aaaf92a217e90a7d56c57598fdf93b5 100644 (file)
@@ -10,6 +10,7 @@ mod list;
 
 #[cfg_attr(windows, path = "watch_win.rs")]
 #[cfg_attr(target_vendor = "apple", path = "watch_mac.rs")]
+#[cfg_attr(target_os = "linux", path = "watch_linux.rs")]
 mod watch;
 
 #[cfg(unix)]
diff --git a/src/watch_linux.rs b/src/watch_linux.rs
new file mode 100644 (file)
index 0000000..74c1465
--- /dev/null
@@ -0,0 +1,13 @@
+use crate::Update;\r
+use crate::Error;\r
+\r
+pub(crate) struct WatchHandle;\r
+\r
+pub(crate) fn watch_interfaces<F: FnMut(Update) + 'static>(\r
+    callback: F,\r
+) -> Result<WatchHandle, Error> {\r
+    // stop current worker thread\r
+    // post this into a thread that will use it\r
+    drop(callback);\r
+    Ok(WatchHandle)\r
+}\r