This commit is contained in:
2026-01-06 12:49:26 -07:00
commit dfa968ec7d
155 changed files with 539774 additions and 0 deletions

26
src/debug.rs Normal file
View File

@@ -0,0 +1,26 @@
#[cfg(feature = "debug-trace")]
macro_rules! trace {
($($arg:tt)*) => {
eprintln!("[TRACE] {}", format!($($arg)*));
};
}
#[cfg(not(feature = "debug-trace"))]
macro_rules! trace {
($($arg:tt)*) => {};
}
pub(crate) use trace;
pub fn hex_preview(data: &[u8], len: usize) -> String {
let preview: Vec<String> = data
.iter()
.take(len)
.map(|b| format!("{:02x}", b))
.collect();
if data.len() > len {
format!("{}... ({} bytes)", preview.join(""), data.len())
} else {
preview.join("")
}
}