summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJoakim Hulthe <joakim.hulthe@mullvad.net>2025-10-16 16:50:30 +0200
committerJoakim Hulthe <joakim.hulthe@mullvad.net>2025-10-24 13:54:26 +0200
commit831d2e9c77f438b73a8771384a8a4d781ddc0576 (patch)
tree9d57180ee9cb796efe678bc5761dd6acb4f70b51
parentfd0a265b043d96efe0bca672cbf40562b4a942e9 (diff)
downloadmullvadvpn-831d2e9c77f438b73a8771384a8a4d781ddc0576.tar.xz
mullvadvpn-831d2e9c77f438b73a8771384a8a4d781ddc0576.zip
Impl Eq & Ord for Rollout
-rw-r--r--mullvad-update/src/version.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/mullvad-update/src/version.rs b/mullvad-update/src/version.rs
index 46e7489f67..90e655daf6 100644
--- a/mullvad-update/src/version.rs
+++ b/mullvad-update/src/version.rs
@@ -205,6 +205,17 @@ impl TryFrom<f32> for Rollout {
}
}
+impl Eq for Rollout {}
+
+#[allow(clippy::derive_ord_xor_partial_ord)] // we impl Ord in terms of PartalOrd, so it's fine
+impl Ord for Rollout {
+ fn cmp(&self, other: &Self) -> Ordering {
+ debug_assert!(self.0.is_finite());
+ debug_assert!(other.0.is_finite());
+ self.partial_cmp(other).expect("rollout is always in 0..=1")
+ }
+}
+
// TODO: the mullvad-release cli might rely on this being formatted as an f32
impl Display for Rollout {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {