use derive macros
This commit is contained in:
parent
c362081003
commit
f4d28dd3c3
@ -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{
|
||||
|
@ -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{
|
||||
|
@ -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],
|
||||
}
|
||||
|
@ -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],
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user