Skip to content

Commit

Permalink
add support for storing if a node is subsumed
Browse files Browse the repository at this point in the history
  • Loading branch information
saulshanabrook committed Sep 11, 2024
1 parent 9ce2812 commit 325f7c6
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,14 @@ impl std::ops::Index<&ClassId> for EGraph {
}
}

#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
#[derive(Debug, Default, Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
pub struct NodeData {
//
#[cfg_attr(feature = "serde", serde(default))]
pub subsumed: bool,
}

#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct Node {
Expand All @@ -171,6 +179,9 @@ pub struct Node {
pub eclass: ClassId,
#[cfg_attr(feature = "serde", serde(default = "one"))]
pub cost: Cost,
// Optional data about the node
#[cfg_attr(feature = "serde", serde(default))]
pub data: NodeData,
}

impl Node {
Expand Down

0 comments on commit 325f7c6

Please sign in to comment.