From a64d5afc96e52914b08b10a559d13b8032f5eb08 Mon Sep 17 00:00:00 2001 From: javalsai Date: Fri, 5 Dec 2025 22:15:51 +0100 Subject: [PATCH] dbg: few display changes --- 2025/tester.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/2025/tester.rs b/2025/tester.rs index 48dd0e1..9f37c7a 100644 --- a/2025/tester.rs +++ b/2025/tester.rs @@ -113,7 +113,7 @@ pub mod dl { } pub mod loader { - use std::time::{Duration, Instant}; + use std::{fmt::Display, time::{Duration, Instant}}; use crate::dl::Handle; @@ -139,6 +139,17 @@ pub mod loader { UsizeDuple((usize, usize)), } + impl Display for FnRetVariant { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + FnRetVariant::Isize(v) => write!(f, "isize {v}"), + FnRetVariant::Usize(v) => write!(f, "usize {v}"), + FnRetVariant::IsizeDuple((v1, v2)) => write!(f, "isize ({v1}, {v2})"), + FnRetVariant::UsizeDuple((v1, v2)) => write!(f, "usize ({v1}, {v2})"), + } + } + } + impl FnVariant { /// Ideally the fn would be put on the heap, but that requires customly allocating /// executable memory, a DST pain other stuff I can't be concerned with rn. @@ -317,7 +328,7 @@ fn run_input(day: &str, input: &[u8], rustc: Option<&str>) -> io::Result<()> { let total_time = start.elapsed(); println!( - "\x1b[32mdone\x1b[0m in \x1b[35m{total_time:#?}\x1b[0m and yielded result \x1b[36m{result:?}\x1b[0m", + "\x1b[32mdone\x1b[0m in \x1b[4;35m{total_time:#?}\x1b[0m with \x1b[36m{result}\x1b[0m", ); if let Some(timers) = loader::load_timers_from(&challenge) { let mut prev_t = Duration::ZERO;