-
Notifications
You must be signed in to change notification settings - Fork 6
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
feat!: Replace GATs with impl Iterator
returns (RPITIT) on HugrView
#1660
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1660 +/- ##
==========================================
+ Coverage 85.51% 85.55% +0.03%
==========================================
Files 136 136
Lines 25264 25325 +61
Branches 22176 22237 +61
==========================================
+ Hits 21605 21667 +62
+ Misses 2455 2453 -2
- Partials 1204 1205 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
This PR contains breaking changes to the public Rust API. cargo-semver-checks summary
|
impl Iterator
returns (RPITIT) on HugrView
impl Iterator
returns (RPITIT) on HugrView
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.
🙏
@@ -40,36 +37,6 @@ use itertools::Either; | |||
/// A trait for inspecting HUGRs. | |||
/// For end users we intend this to be superseded by region-specific APIs. | |||
pub trait HugrView: HugrInternals { | |||
/// An Iterator over the nodes in a Hugr(View) |
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.
🙌
.nodes() | ||
.with_context(self) | ||
.map_with_context(|n, &wrapper| HugrNodeRef::from_node(n, wrapper.hugr)) | ||
Box::new( |
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.
I'm surprised this is not tested
@@ -251,6 +223,16 @@ pub struct SiblingMut<'g, Root = Node> { | |||
_phantom: std::marker::PhantomData<Root>, | |||
} | |||
|
|||
impl<'g, Root> SiblingMut<'g, Root> { |
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.
is this a drive-by? unrelated?
&self, | ||
node: Node, | ||
port: impl Into<Port>, | ||
) -> impl Iterator<Item = (Node, Port)> + Clone { | ||
// Need to filter only to links inside the sibling graph |
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.
this comment now works better at the bottom of the function
} | ||
|
||
fn node_connections(&self, node: Node, other: Node) -> Self::NodeConnections<'_> { | ||
fn node_connections(&self, node: Node, other: Node) -> impl Iterator<Item = [Port; 2]> + Clone { | ||
// Need to filter only to connections inside the sibling graph | ||
SiblingGraph::<'_, Node>::new_unchecked(self.hugr, self.root) |
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.
would some of these methods also benefit from the portgraph based implementation seen in linked_ports
This will simplify the update to the next portgraph release (which also moved to RPITIT), avoiding the need to use boxes around iterators to be able to name them.
context-iterators
BREAKING CHANGE: Removed
HugrView
associated iterator types, replaced withimpl Iterator
returns.