Add proper implementation of debug for Num

This commit is contained in:
Gwilym Kuiper 2021-06-05 17:22:23 +01:00
parent e78c9abcec
commit 8b2dfdffc1

View file

@ -1,9 +1,9 @@
use core::{
fmt::Display,
fmt::{Debug, Display},
ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Neg, Rem, RemAssign, Sub, SubAssign},
};
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Debug)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
pub struct Num<const N: usize>(i32);
pub fn change_base<const N: usize, const M: usize>(num: Num<N>) -> Num<M> {
@ -223,3 +223,9 @@ impl<const N: usize> Display for Num<N> {
Ok(())
}
}
impl<const N: usize> Debug for Num<N> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self)
}
}