Skip to content

Commit 9cec0dc

Browse files
committed
implement CallError for Store
1 parent 95961aa commit 9cec0dc

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

crates/providers/src/program_node.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ use crate::tensor::{Tensor, TensorType};
1515

1616
/// A node in a quantum program graph that transforms tensors.
1717
pub trait ProgramNode {
18+
type CallError;
19+
1820
/// The name of this program node.
1921
fn name(&self) -> &str;
2022

@@ -26,16 +28,15 @@ pub trait ProgramNode {
2628
format!("{}.{}", self.namespace(), self.name())
2729
}
2830

29-
/// The inputs expected at `call` time.
31+
/// The inputs expected at call time.
3032
fn input_types(&self) -> &DataTree<TensorType>;
3133

32-
/// The outputs promised on `call` return.
34+
/// The outputs promised on call return.
3335
fn output_types(&self) -> &DataTree<TensorType>;
3436

3537
/// Whether this program node implements the call method.
3638
fn implements_call(&self) -> bool;
3739

3840
/// The action of this program node.
39-
type CallError;
4041
fn call(&self, args: &DataTree<Tensor>) -> Result<DataTree<Tensor>, Self::CallError>;
4142
}

crates/providers/src/store.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ fn derive_output_types(data: &DataTree<Tensor>) -> DataTree<TensorType> {
6161
}
6262

6363
impl ProgramNode for Store {
64+
type CallError = std::convert::Infallible;
65+
6466
fn name(&self) -> &str {
6567
"store"
6668
}
@@ -81,7 +83,7 @@ impl ProgramNode for Store {
8183
true
8284
}
8385

84-
fn call(&self, _args: &DataTree<Tensor>) -> anyhow::Result<DataTree<Tensor>> {
86+
fn call(&self, _args: &DataTree<Tensor>) -> Result<DataTree<Tensor>, Self::CallError> {
8587
Ok(self.data.clone())
8688
}
8789
}

0 commit comments

Comments
 (0)