From 14b87400ba8128aef21957ec1d19ae5ea242d92b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E4=BC=9A=E8=8C=97?= Date: Thu, 19 Oct 2023 14:47:29 +0800 Subject: [PATCH 1/2] fix: impl PartialEq for [u8] --- src/ivec.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/ivec.rs b/src/ivec.rs index ebd7de395..57c2890e8 100644 --- a/src/ivec.rs +++ b/src/ivec.rs @@ -295,6 +295,18 @@ impl PartialEq<[u8]> for IVec { impl Eq for IVec {} +impl PartialOrd for [u8] { + fn partial_cmp(&self, other: &IVec) -> Option { + <[u8] as PartialOrd<[u8]>>::partial_cmp(self, other) + } +} + +impl PartialEq for [u8] { + fn eq(&self, other: &IVec) -> bool { + *self == *other + } +} + impl fmt::Debug for IVec { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { self.as_ref().fmt(f) From d0f87bc34bc8144f10090dd15ee3078d2e6b30d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E4=BC=9A=E8=8C=97?= Date: Mon, 23 Oct 2023 19:02:18 +0800 Subject: [PATCH 2/2] fix eq --- src/ivec.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ivec.rs b/src/ivec.rs index 57c2890e8..99715cda8 100644 --- a/src/ivec.rs +++ b/src/ivec.rs @@ -303,7 +303,7 @@ impl PartialOrd for [u8] { impl PartialEq for [u8] { fn eq(&self, other: &IVec) -> bool { - *self == *other + self.eq(other.deref()) } }