Skip to main content

fastnum/decimal/udec/impls/
fmt.rs

1use core::fmt::{self, Debug, Display, Formatter, LowerExp, UpperExp};
2
3use crate::decimal::{utils, UnsignedDecimal};
4
5impl<const N: usize> Display for UnsignedDecimal<N> {
6    #[inline]
7    fn fmt(&self, f: &mut Formatter) -> fmt::Result {
8        Display::fmt(&self.0, f)
9    }
10}
11
12impl<const N: usize> LowerExp for UnsignedDecimal<N> {
13    #[inline]
14    fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
15        LowerExp::fmt(&self.0, f)
16    }
17}
18
19impl<const N: usize> UpperExp for UnsignedDecimal<N> {
20    #[inline]
21    fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
22        UpperExp::fmt(&self.0, f)
23    }
24}
25
26impl<const N: usize> Debug for UnsignedDecimal<N> {
27    #[inline]
28    fn fmt(&self, f: &mut Formatter) -> fmt::Result {
29        utils::fmt::debug_print(
30            &self.0.digits(),
31            &self.0.control_block(),
32            Self::type_name(),
33            f,
34        )
35    }
36}