dbg: few display changes

This commit is contained in:
2025-12-05 22:15:51 +01:00
parent da7ab076f2
commit a64d5afc96

View File

@@ -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;