meritrank/
debug.rs

1use std::fmt;
2
3use crate::{NodeId, PosWalk, RandomWalk, WalkStorage};
4
5impl fmt::Debug for NodeId {
6    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
7        // Implement the formatting logic for NodeId
8        // Here you can format the NodeId fields as desired
9        match self {
10            NodeId::Int(id) => write!(f, "NodeId::Int({})", id),
11            NodeId::UInt(id) => write!(f, "NodeId::UInt({})", id),
12            NodeId::None => write!(f, "NodeId::None"),
13        }
14    }
15}
16
17// impl fmt::Debug for WalkId {
18//     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
19//         // Implement the formatting logic for WalkId
20//         // Here you can format the WalkId fields as desired
21//         write!(f, "WalkId {{ id: {:?} }}", self.id)
22//     }
23// }
24
25impl fmt::Debug for RandomWalk {
26    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
27        // Implement the formatting logic for RandomWalk
28        // Here you can format the RandomWalk fields as desired
29        write!(f, "RandomWalk {{ nodes: {:?} }}", self.get_nodes())
30    }
31}
32
33impl fmt::Debug for WalkStorage {
34    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
35        // Implement the formatting logic for WalkStorage
36        // Here you can format the storage contents as desired
37        let sorted_walks: std::collections::BTreeMap<_, _> = self.get_walks().iter().collect();
38
39        write!(f, "WalkStorage {{ walks: {:?} }}", sorted_walks)
40    }
41}
42
43impl fmt::Debug for PosWalk {
44    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
45        // Implement the formatting logic for PosWalk
46        // Here you can format the PosWalk fields as desired
47        write!(
48            f,
49            "PosWalk {{ pos: {:?}, walk: {:?} }}",
50            self.get_pos(),
51            self.get_walk()
52        )
53    }
54}