Skip to content

Commit

Permalink
Add PartialEq impls to mirror the stdlib (#358)
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Saveau <[email protected]>
  • Loading branch information
SUPERCILEX authored Jul 27, 2024
1 parent 1dd57a4 commit fc984cb
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2020,6 +2020,56 @@ where
}
impl<T, const N: usize> Eq for SmallVec<T, N> where T: Eq {}

impl<T, U, const N: usize, const M: usize> PartialEq<[U; M]> for SmallVec<T, N>
where
T: PartialEq<U>,
{
#[inline]
fn eq(&self, other: &[U; M]) -> bool {
self[..] == other[..]
}
}

impl<T, U, const N: usize, const M: usize> PartialEq<&[U; M]> for SmallVec<T, N>
where
T: PartialEq<U>,
{
#[inline]
fn eq(&self, other: &&[U; M]) -> bool {
self[..] == other[..]
}
}

impl<T, U, const N: usize> PartialEq<[U]> for SmallVec<T, N>
where
T: PartialEq<U>,
{
#[inline]
fn eq(&self, other: &[U]) -> bool {
self[..] == other[..]
}
}

impl<T, U, const N: usize> PartialEq<&[U]> for SmallVec<T, N>
where
T: PartialEq<U>,
{
#[inline]
fn eq(&self, other: &&[U]) -> bool {
self[..] == other[..]
}
}

impl<T, U, const N: usize> PartialEq<&mut [U]> for SmallVec<T, N>
where
T: PartialEq<U>,
{
#[inline]
fn eq(&self, other: &&mut [U]) -> bool {
self[..] == other[..]
}
}

impl<T, const N: usize> PartialOrd for SmallVec<T, N>
where
T: PartialOrd,
Expand Down

0 comments on commit fc984cb

Please sign in to comment.