Skip to main content

slotted_egraphs/
debug.rs

1use crate::*;
2use std::fmt::*;
3
4impl Debug for Id {
5    fn fmt(&self, f: &mut Formatter<'_>) -> Result {
6        write!(f, "id{}", self.0)
7    }
8}
9
10#[cfg(feature = "explanations")]
11impl Debug for Equation {
12    fn fmt(&self, f: &mut Formatter<'_>) -> Result {
13        write!(f, "{:?} = {:?}", self.l, self.r)
14    }
15}
16
17impl Debug for SlotMap {
18    fn fmt(&self, f: &mut Formatter<'_>) -> Result {
19        write!(f, "[")?;
20        let n = self.len();
21        for (i, (x, y)) in self.iter().enumerate() {
22            write!(f, "{x:?} -> {y:?}")?;
23            if i < n - 1 {
24                write!(f, ", ")?;
25            }
26        }
27        write!(f, "]")
28    }
29}
30
31impl Debug for AppliedId {
32    fn fmt(&self, f: &mut Formatter<'_>) -> Result {
33        write!(f, "{:?}{:?}", self.id, self.m)
34    }
35}
36
37impl<L: Language, N: Analysis<L>> Debug for EGraph<L, N> {
38    fn fmt(&self, _f: &mut Formatter<'_>) -> Result {
39        todo!()
40    }
41}