use derive macros

This commit is contained in:
Quaternions 2024-09-05 15:43:02 -07:00
parent c362081003
commit f4d28dd3c3
4 changed files with 2 additions and 30 deletions

View File

@ -32,20 +32,6 @@ macro_rules! impl_matrix {
}
}
impl<const X:usize,const Y:usize,T:PartialEq> PartialEq for Matrix<X,Y,T>{
fn eq(&self,other:&Self)->bool{
self.array==other.array
}
}
impl<const X:usize,const Y:usize,T:Eq> Eq for Matrix<X,Y,T>{}
impl<const X:usize,const Y:usize,T:core::hash::Hash> core::hash::Hash for Matrix<X,Y,T>{
fn hash<H:core::hash::Hasher>(&self,state:&mut H){
self.array.hash(state);
}
}
impl<const X:usize,const Y:usize,T:Default> Default for Matrix<X,Y,T>{
fn default()->Self{
Self{

View File

@ -40,20 +40,6 @@ macro_rules! impl_vector {
}
}
impl<const N:usize,T:PartialEq> PartialEq for Vector<N,T>{
fn eq(&self,other:&Self)->bool{
self.array==other.array
}
}
impl<const N:usize,T:Eq> Eq for Vector<N,T>{}
impl<const N:usize,T:core::hash::Hash> core::hash::Hash for Vector<N,T>{
fn hash<H:core::hash::Hasher>(&self,state:&mut H){
self.array.hash(state);
}
}
impl<const N:usize,T:Default> Default for Vector<N,T>{
fn default()->Self{
Self{

View File

@ -1,4 +1,4 @@
#[derive(Clone,Copy)]
#[derive(Clone,Copy,Hash,Eq,PartialEq)]
pub struct Matrix<const X:usize,const Y:usize,T>{
pub(crate) array:[[T;Y];X],
}

View File

@ -1,4 +1,4 @@
#[derive(Clone,Copy)]
#[derive(Clone,Copy,Hash,Eq,PartialEq)]
pub struct Vector<const N:usize,T>{
pub(crate) array:[T;N],
}