diff --git a/ascent_base/src/lattice/bounded_set.rs b/ascent_base/src/lattice/bounded_set.rs index 37d45cc..4670498 100644 --- a/ascent_base/src/lattice/bounded_set.rs +++ b/ascent_base/src/lattice/bounded_set.rs @@ -7,7 +7,7 @@ use crate::Lattice; /// `BoundedSet` is a generalization of the flat lattice. /// /// A `BoundedSet` stores at most `BOUND` items, and if asked to store more, will go to `TOP`. -#[derive(Clone, PartialEq, Eq, Hash)] +#[derive(Clone, PartialEq, Eq, Hash, Debug)] pub struct BoundedSet(Option>); impl Default for BoundedSet { diff --git a/ascent_base/src/lattice/constant_propagation.rs b/ascent_base/src/lattice/constant_propagation.rs index 195858f..74b8195 100644 --- a/ascent_base/src/lattice/constant_propagation.rs +++ b/ascent_base/src/lattice/constant_propagation.rs @@ -3,7 +3,7 @@ use std::cmp::Ordering; use super::{BoundedLattice, Lattice}; /// A flat `Lattice`: `Bottom` <= everything <= `Top`, and `Constant(x) == Constant(y)` iff `x == y` -#[derive(PartialEq, Eq, Clone, Copy, Debug, Hash)] +#[derive(PartialEq, Eq, Clone, Copy, Hash, Debug)] #[allow(dead_code)] pub enum ConstPropagation { Bottom, diff --git a/ascent_base/src/lattice/ord_lattice.rs b/ascent_base/src/lattice/ord_lattice.rs index ac97e41..e63040b 100644 --- a/ascent_base/src/lattice/ord_lattice.rs +++ b/ascent_base/src/lattice/ord_lattice.rs @@ -1,8 +1,18 @@ +use std::fmt::{Debug, Display, Formatter}; + use crate::Lattice; -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)] +#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct OrdLattice(pub T); +impl Debug for OrdLattice { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { self.0.fmt(f) } +} + +impl Display for OrdLattice { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { self.0.fmt(f) } +} + impl Lattice for OrdLattice { #[inline(always)] fn meet(self, other: Self) -> Self { self.min(other) } diff --git a/ascent_base/src/lattice/set.rs b/ascent_base/src/lattice/set.rs index 1903750..725d3d2 100644 --- a/ascent_base/src/lattice/set.rs +++ b/ascent_base/src/lattice/set.rs @@ -1,5 +1,6 @@ use std::cmp::Ordering; use std::collections::BTreeSet; +use std::fmt::{Debug, Formatter}; use std::hash::Hash; use std::ops::Deref; @@ -22,6 +23,10 @@ impl Default for Set { fn default() -> Self { Self(Default::default()) } } +impl Debug for Set { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { self.0.fmt(f) } +} + impl Deref for Set { type Target = BTreeSet;