From bf3ed7ff2472dadcea411ec0d824e1fcadc7aea2 Mon Sep 17 00:00:00 2001 From: Alex Janka Date: Sun, 18 Aug 2024 19:35:50 +1000 Subject: [PATCH] types: better debug impl for BoundedAddress --- lib/src/processor/memory/addresses/types.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/src/processor/memory/addresses/types.rs b/lib/src/processor/memory/addresses/types.rs index a55f64f..6e041ee 100644 --- a/lib/src/processor/memory/addresses/types.rs +++ b/lib/src/processor/memory/addresses/types.rs @@ -5,9 +5,15 @@ use std::{ use crate::error::AddressError; -#[derive(Copy, Clone, Debug)] +#[derive(Copy, Clone)] pub(crate) struct BoundedAddress(u16); +impl std::fmt::Debug for BoundedAddress { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{:#04X}", self.0) + } +} + impl Display for BoundedAddress { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { Display::fmt(&self.0, f)