From 4ffa38480f45f8444926900f1e3558ab2c2341c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20B=C3=BChler?= Date: Mon, 30 Sep 2024 14:36:20 +0200 Subject: [PATCH] use bitstring 0.2 --- Cargo.toml | 2 +- src/cidr/direct.rs | 5 ++++- src/inet/direct.rs | 5 ++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 46f76a8..62fc32a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,7 +26,7 @@ bitstring = ["dep:bitstring"] serde = ["dep:serde"] [dependencies] -bitstring = { version = "0.1.0", optional = true } +bitstring = { version = "0.2.0", optional = true, features = ["net"] } serde = { version = "1.0.27", optional = true } [dev-dependencies] diff --git a/src/cidr/direct.rs b/src/cidr/direct.rs index c4707fb..be68fe7 100644 --- a/src/cidr/direct.rs +++ b/src/cidr/direct.rs @@ -71,7 +71,10 @@ macro_rules! impl_cidr_for { fn shared_prefix_len(&self, other: &Self) -> usize { let max_len = core::cmp::min(self.network_length, other.network_length) as usize; - FixedBitString::shared_prefix_len(&self.address, &other.address, max_len) + core::cmp::min( + FixedBitString::shared_prefix_len(&self.address, &other.address), + max_len, + ) } } diff --git a/src/inet/direct.rs b/src/inet/direct.rs index 5f4ffd1..0af3525 100644 --- a/src/inet/direct.rs +++ b/src/inet/direct.rs @@ -68,7 +68,10 @@ macro_rules! impl_inet_for { fn shared_prefix_len(&self, other: &Self) -> usize { let max_len = core::cmp::min(self.network_length, other.network_length) as usize; - FixedBitString::shared_prefix_len(&self.address, &other.address, max_len) + core::cmp::min( + FixedBitString::shared_prefix_len(&self.address, &other.address), + max_len, + ) } }