implement Debug + Display

This commit is contained in:
2024-09-11 12:06:58 -07:00
parent 7b78338c76
commit 9f77531995
5 changed files with 74 additions and 2 deletions
fixed_wide/src
linear_ops/src

@ -47,6 +47,17 @@ macro_rules! impl_vector {
}
}
impl<const N:usize,T:core::fmt::Display> core::fmt::Display for Vector<N,T>{
#[inline]
fn fmt(&self,f:&mut core::fmt::Formatter)->Result<(),core::fmt::Error>{
for elem in &self.array[0..N-1]{
core::write!(f,"{}, ",elem)?;
}
// assume we will be using vectors of length 1 or greater
core::write!(f,"{}",self.array.last().unwrap())
}
}
impl<const N:usize,T:Ord> Vector<N,T>{
#[inline]
pub fn min(self,rhs:Self)->Self{