mirror of
https://github.com/italicsjenga/agb.git
synced 2025-01-11 09:31:34 +11:00
Add proper implementation of debug for Num
This commit is contained in:
parent
e78c9abcec
commit
8b2dfdffc1
|
@ -1,9 +1,9 @@
|
||||||
use core::{
|
use core::{
|
||||||
fmt::Display,
|
fmt::{Debug, Display},
|
||||||
ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Neg, Rem, RemAssign, Sub, SubAssign},
|
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 struct Num<const N: usize>(i32);
|
||||||
|
|
||||||
pub fn change_base<const N: usize, const M: usize>(num: Num<N>) -> Num<M> {
|
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(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<const N: usize> Debug for Num<N> {
|
||||||
|
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||||
|
write!(f, "{}", self)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue