Skip to content

Commit

Permalink
feat: Port is serializable (#489)
Browse files Browse the repository at this point in the history
I need something like this to be able to serialize pattern matcher in
TKET2 (more specifically: to serialize predicates for matching). I'm not
sure this is the right approach or you'd rather I expose a different
serialization API in HUGR for this purpose.
  • Loading branch information
lmondada committed Sep 5, 2023
1 parent d117512 commit abfaba6
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/hugr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,21 @@ pub struct Node {
}

/// A handle to a port for a node in the HUGR.
#[derive(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Hash, Default, Debug, From)]
#[derive(
Clone,
Copy,
PartialEq,
PartialOrd,
Eq,
Ord,
Hash,
Default,
Debug,
From,
serde::Serialize,
serde::Deserialize,
)]
#[serde(transparent)]
#[cfg_attr(feature = "pyo3", pyclass)]
pub struct Port {
offset: portgraph::PortOffset,
Expand Down

0 comments on commit abfaba6

Please sign in to comment.