X-Git-Url: https://code.octet-stream.net/netwatcher/blobdiff_plain/325d5d14560f2190818d6826366dfe88d3857302..f5cae732095b884b50921e13827ef6d7375c7c3b:/src/watch_mac.rs?ds=inline diff --git a/src/watch_mac.rs b/src/watch_mac.rs index de0e650..c44169c 100644 --- a/src/watch_mac.rs +++ b/src/watch_mac.rs @@ -22,6 +22,8 @@ unsafe impl objc2::Encode for NwPath { const ENCODING: Encoding = usize::ENCODING; } +unsafe impl Send for WatchHandle {} + #[link(name = "Network", kind = "framework")] extern "C" { fn nw_path_monitor_create() -> NwPathMonitorT; @@ -42,7 +44,9 @@ pub(crate) struct WatchHandle { impl Drop for WatchHandle { fn drop(&mut self) { - unsafe { nw_path_monitor_cancel(self.path_monitor); } + unsafe { + nw_path_monitor_cancel(self.path_monitor); + } } } @@ -83,7 +87,5 @@ pub(crate) fn watch_interfaces( nw_path_monitor_set_queue(path_monitor, queue); nw_path_monitor_start(path_monitor); } - Ok(WatchHandle { - path_monitor, - }) + Ok(WatchHandle { path_monitor }) }