Skip to content

Commit

Permalink
hybrid-array: add PartialEq impls for core array (#1025)
Browse files Browse the repository at this point in the history
Simplified comparisons with core arrays
  • Loading branch information
tarcieri committed Dec 31, 2023
1 parent 2bdcea1 commit b45f35f
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions hybrid-array/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,26 @@ where
}
}

impl<T, U, const N: usize> PartialEq<[T; N]> for Array<T, U>
where
T: PartialEq,
U: ArraySize<ArrayType<T> = [T; N]>,
{
fn eq(&self, other: &[T; N]) -> bool {
self.0.eq(other)
}
}

impl<T, U, const N: usize> PartialEq<Array<T, U>> for [T; N]
where
T: PartialEq,
U: ArraySize<ArrayType<T> = [T; N]>,
{
fn eq(&self, other: &Array<T, U>) -> bool {
self.eq(&other.0)
}
}

impl<T, U> PartialOrd for Array<T, U>
where
T: PartialOrd,
Expand Down

0 comments on commit b45f35f

Please sign in to comment.