-
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: Add CircuitMut trait #138
Conversation
I'm changing this to also handle copyable wires, one minute! EDIT: done! |
EDIT: I've added a work-around with a TODO to simplify once the issue is resolved. |
9c15b66
to
2abeaf7
Compare
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 suggest a trait simplification but otherwise this seems ok to be, as you said elsewhere it is worth thinking about how the base api could be improved to avoid the shifting/updating workarounds
src/circuit.rs
Outdated
@@ -120,18 +128,164 @@ pub trait Circuit: HugrView { | |||
} | |||
} | |||
|
|||
/// A circuit object that can be mutated. | |||
pub trait CircuitMut: Circuit + HugrMut { |
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 pretty sure this can be defined without the :Circuit
requirement (just replace calls to input() and output() with get_io).
Further i don't think it needs to be a trait, just a remove_empty_wire
generic function
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.
Done.
I needed this to remove qubits in patterns when they are empty.
I struggled a bit to figure out how to update the types correctly. I hope this is correct, but please have a close look at it, I do not know what I am doing.