From 08a62bdf968af5ba7e6d5d33ef93c1f29ad424c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linus=20F=C3=A4rnstrand?= Date: Wed, 31 Jan 2024 13:33:13 +0100 Subject: [PATCH 1/2] Derive Debug, Copy, Eq, Hash etc on ReachabilityFlag The upgrade from bitflags 1 -> 2 removed them In total we lose the Ord/PartialOrd implementations. But those did not make any sense for this type anyway, so that's good. But breaking. --- system-configuration/src/network_reachability.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/system-configuration/src/network_reachability.rs b/system-configuration/src/network_reachability.rs index 2342c5f..2770ee3 100644 --- a/system-configuration/src/network_reachability.rs +++ b/system-configuration/src/network_reachability.rs @@ -85,6 +85,7 @@ bitflags::bitflags! { /// Rustier interface for [`SCNetworkReachabilityFlags`]. /// /// [`SCNetworkReachability`]: https://developer.apple.com/documentation/systemconfiguration/scnetworkreachabilityflags + #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub struct ReachabilityFlags: u32 { /// The specified node name or address can be reached via a transient connection, such as /// PPP. From 83ce40fac3284ac4230d1d38d0331017336481a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linus=20F=C3=A4rnstrand?= Date: Wed, 31 Jan 2024 13:36:30 +0100 Subject: [PATCH 2/2] Add changelog about changes to ReachabilityFlags --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 95bf3a8..fffc086 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,8 @@ Line wrap the file at 100 chars. Th - Breaking: Mark `SCNetworkReachability::schedule_with_runloop` and `unschedule_from_runloop` as `unsafe`. They accept a raw pointer that it dereferences. Figuring out a safe API around this is left as an exercise for the future. +- Breaking: `ReachabilityFlags` no longer implements `Ord` or `PartialOrd`. It also replaces the + `from_bits_unchecked` constructor with other (safe) `from_bits_*` constructors. ### Fixed - Fix memory leak in `SCNetworkReachability::set_callback`.