Skip to content

Commit

Permalink
Use HugrView::get_io when possible
Browse files Browse the repository at this point in the history
  • Loading branch information
aborgna-q committed Sep 16, 2023
1 parent 2b210dc commit 23737d7
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,14 @@ pub trait Circuit: HugrView {
/// Returns the input node to the circuit.
#[inline]
fn input(&self) -> Node {
return self
.children(self.root())
.next()
.expect("Circuit has no input node");
self.get_io(self.root()).expect("Circuit has no input node")[0]
}

/// Returns the output node to the circuit.
#[inline]
fn output(&self) -> Node {
return self
.children(self.root())
.nth(1)
.expect("Circuit has no output node");
self.get_io(self.root())
.expect("Circuit has no output node")[1]
}

/// The number of quantum gates in the circuit.
Expand Down

0 comments on commit 23737d7

Please sign in to comment.