From fa561958073ea7d607e3be4dfde16d7245515e49 Mon Sep 17 00:00:00 2001 From: Alex Saveau <saveau.alexandre@gmail.com> Date: Fri, 26 Jul 2024 19:20:41 -0700 Subject: [PATCH] Add PartialEq impls to mirror the stdlib Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com> --- src/lib.rs | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index c044c67..4bf7e5a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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,