Add PartialEq to everything (#395)

This commit is contained in:
rickwebiii
2025-03-04 14:21:12 -08:00
committed by GitHub
parent abfe2fed57
commit d454aa2b68
4 changed files with 5 additions and 11 deletions

View File

@@ -24,13 +24,14 @@ macro_rules! dst {
paste::paste! {
$(#[$meta])*
#[derive($($derive,)*)]
#[derive($($derive,)* PartialEq)]
pub struct $t<T> where T: Clone $(+ $t_bounds)* {
data: aligned_vec::AVec<$wrapper<T>, aligned_vec::ConstAlign<{ crate::scratch::SIMD_ALIGN }>>
}
/// A reference to the data structure.
#[repr(transparent)]
#[derive(PartialEq)]
pub struct $ref_t<T> where T: Clone $(+ $t_bounds)* {
data: [$wrapper<T>],
}

View File

@@ -21,7 +21,7 @@ dst! {
Polynomial,
PolynomialRef,
NoWrapper,
(Debug, Clone, PartialEq, Eq, Serialize, Deserialize),
(Debug, Clone, Serialize, Deserialize),
()
}
dst_iter! { PolynomialIterator, PolynomialIteratorMut, ParallelPolynomialIterator, ParallelPolynomialIteratorMut, NoWrapper, PolynomialRef, () }
@@ -375,12 +375,6 @@ where
}
}
impl<T: PartialEq + Clone> PartialEq for PolynomialRef<T> {
fn eq(&self, other: &Self) -> bool {
self.coeffs() == other.coeffs()
}
}
impl<T: std::fmt::Debug + Clone> std::fmt::Debug for PolynomialRef<T> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("PolynomialRef")
@@ -398,7 +392,6 @@ mod tests {
#[test]
fn can_add_polynomials() {
let a = Polynomial::new(&[1, 2, 3]);
let b = Polynomial::new(&[4, 5, 6]);
let expected = Polynomial::new(&[5, 7, 9]);

View File

@@ -15,7 +15,7 @@ dst! {
PolynomialFft,
PolynomialFftRef,
NoWrapper,
(Debug, Clone, PartialEq, Eq,),
(Debug, Clone),
()
}
dst_iter!(

View File

@@ -12,7 +12,7 @@ dst! {
PolynomialList,
PolynomialListRef,
NoWrapper,
(Debug, Clone, PartialEq, Eq,),
(Debug, Clone),
()
}