diff --git a/src/runtime/mod.rs b/src/runtime/mod.rs index 07bf1cb62b5e520d2d9356c9bc475e1cc4f7d19b..2223cf6be13fcbd670fa28299647756c2e8cea80 100644 --- a/src/runtime/mod.rs +++ b/src/runtime/mod.rs @@ -1,5 +1,5 @@ mod communication; -mod error; +pub mod error; mod setup2; #[cfg(test)] @@ -144,12 +144,12 @@ pub enum ConnectorPhased { neighborhood: Neighborhood, mem_inbox: Vec, native_batches: Vec, - round_result: Result, SyncError>, + round_result: Result)>, SyncError>, }, } #[derive(Debug)] pub struct StringLogger(ControllerId, String); -#[derive(Default, Debug, Clone, Eq, PartialEq, Hash, serde::Serialize, serde::Deserialize)] +#[derive(Default, Clone, Eq, PartialEq, Hash, serde::Serialize, serde::Deserialize)] pub struct Predicate { pub assigned: BTreeMap, } @@ -545,3 +545,24 @@ impl Predicate { self.assigned.get(&x).copied() } } +impl Debug for Predicate { + fn fmt(&self, f: &mut Formatter) -> std::fmt::Result { + struct MySet<'a>(&'a Predicate, bool); + impl Debug for MySet<'_> { + fn fmt(&self, f: &mut Formatter) -> std::fmt::Result { + let iter = self.0.assigned.iter().filter_map(|(port, &firing)| { + if firing == self.1 { + Some(port) + } else { + None + } + }); + f.debug_set().entries(iter).finish() + } + } + f.debug_struct("Predicate") + .field("Trues", &MySet(self, true)) + .field("Falses", &MySet(self, false)) + .finish() + } +}