File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,6 +15,8 @@ use crate::tensor::{Tensor, TensorType};
1515
1616/// A node in a quantum program graph that transforms tensors.
1717pub 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}
Original file line number Diff line number Diff line change @@ -61,6 +61,8 @@ fn derive_output_types(data: &DataTree<Tensor>) -> DataTree<TensorType> {
6161}
6262
6363impl 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}
You can’t perform that action at this time.
0 commit comments