Skip to content

Commit e3cfa98

Browse files
author
Brendan Molloy
committed
Handle heterogenous vector sizes
1 parent f1f48b3 commit e3cfa98

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/string.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -439,9 +439,9 @@ impl<const N: usize> PartialEq<String<N>> for &str {
439439

440440
impl<const N: usize> Eq for String<N> {}
441441

442-
impl<const N: usize> PartialOrd for String<N> {
442+
impl<const N1: usize, const N2: usize> PartialOrd<String<N2>> for String<N1> {
443443
#[inline]
444-
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
444+
fn partial_cmp(&self, other: &String<N2>) -> Option<Ordering> {
445445
PartialOrd::partial_cmp(&**self, &**other)
446446
}
447447
}

src/vec.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -764,12 +764,11 @@ where
764764
// Implements Eq if underlying data is Eq
765765
impl<T, const N: usize> Eq for Vec<T, N> where T: Eq {}
766766

767-
impl<T, const N: usize> PartialOrd for Vec<T, N>
767+
impl<T, const N1: usize, const N2: usize> PartialOrd<Vec<T, N2>> for Vec<T, N1>
768768
where
769769
T: PartialOrd,
770770
{
771-
#[inline]
772-
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
771+
fn partial_cmp(&self, other: &Vec<T, N2>) -> Option<Ordering> {
773772
PartialOrd::partial_cmp(&**self, &**other)
774773
}
775774
}

0 commit comments

Comments
 (0)