Implement std::fmt::Debug for Stack
@@ -94,7 +94,6 @@ impl Marker {
}
/// The evaluation stack.
-#[derive(Debug)]
pub struct Stack(Vec<Marker>);
impl IntoIterator for Stack {
@@ -313,6 +312,16 @@ impl Stack {
}
}
+impl std::fmt::Debug for Stack {
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ write!(f, "--- STACK ---")?;
+ for marker in self.0.iter().rev() {
+ write!(f, "| {:?}", marker)?;
+ }
+ write!(f, "--- END ---")
+ }
+}
+
#[cfg(test)]
mod tests {
use super::*;
