-
Notifications
You must be signed in to change notification settings - Fork 13
feat!: Return a node mapping in HugrInternals::region_portgraph #2164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
This PR contains breaking changes to the public Rust API. cargo-semver-checks summary |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2164 +/- ##
=======================================
Coverage 82.10% 82.10%
=======================================
Files 227 227
Lines 39795 39805 +10
Branches 35894 35904 +10
=======================================
+ Hits 32672 32682 +10
Misses 5301 5301
Partials 1822 1822
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks amazing, thanks @aborgna-q!
I've tried to remove the methods
#[inline]
fn to_portgraph_node(&self, node: impl NodeHandle<Self::Node>) -> portgraph::NodeIndex {
node.node().into_portgraph()
}
#[inline]
fn from_portgraph_node(&self, index: portgraph::NodeIndex) -> Self::Node {
index.into()
}in HugrInternals and all their uses, but I've hit a roadblock in the implementation of HugrMut::insert_from_view. This turns the view into a portgraph view and then inserts that.
Do you have a plan on how to rewrite that? It's not obvious to me how an implementation of insert_from_view would look if we remove the fn portgraph method. In any case, it seems big enough to be its own PR.
|
There's a TODO in
hugr/hugr-core/src/hugr/hugrmut.rs Lines 569 to 571 in 851e396
We'll need to implement that to remove those uses :/ |
b070f39 to
3370bf9
Compare
Closes #2158
Annoyingly, we still need to return a
FlatRegion(or some other concrete wrapper) here so that references to the graph implements some of petgraph's traits (likeIntoNodeIdentifiers) which are normally implemented for&'_ G. There's no way to write that in a GAT constraint :/We'll have to wait for the big petgraph rewrite to clean that.
BREAKING CHANGE:
HugrInternals::region_portgraphnow also returns a node mapping between hugr and portgraph nodes