From 0ae8697eb881134115ecb1439bdd41c6a4c5c59d Mon Sep 17 00:00:00 2001 From: Alex Janka Date: Wed, 7 Feb 2024 15:47:24 +1100 Subject: [PATCH] fmt rom address --- lib/src/processor/memory/addresses.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/src/processor/memory/addresses.rs b/lib/src/processor/memory/addresses.rs index a93f1f7..a742c1b 100644 --- a/lib/src/processor/memory/addresses.rs +++ b/lib/src/processor/memory/addresses.rs @@ -1,4 +1,7 @@ -use std::ops::{Add, Sub}; +use std::{ + fmt::UpperHex, + ops::{Add, Sub}, +}; pub(crate) use self::types::*; @@ -33,6 +36,15 @@ pub(crate) enum RomAddress { MappedBank(MappedBankAddress), } +impl UpperHex for RomAddress { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + RomAddress::Bank0(a) => a.fmt(f), + RomAddress::MappedBank(a) => a.fmt(f), + } + } +} + #[derive(Clone, Copy)] pub(crate) enum IoAddress { Joypad,