@@ -51,7 +51,7 @@ pub trait RasterOperator:
5151 #[ allow( clippy:: used_underscore_items) ] // TODO: maybe rename?
5252 let op = self . _initialize ( path. clone ( ) , context) . await ?;
5353
54- Ok ( context. wrap_initialized_raster_operator ( op, span, path ) )
54+ Ok ( context. wrap_initialized_raster_operator ( op, span) )
5555 }
5656
5757 /// Wrap a box around a `RasterOperator`
@@ -86,7 +86,7 @@ pub trait VectorOperator:
8686 let span = self . span ( ) ;
8787 debug ! ( "Initialize {}, path: {}" , self . typetag_name( ) , & path) ;
8888 let op = self . _initialize ( path. clone ( ) , context) . await ?;
89- Ok ( context. wrap_initialized_vector_operator ( op, span, path ) )
89+ Ok ( context. wrap_initialized_vector_operator ( op, span) )
9090 }
9191
9292 /// Wrap a box around a `VectorOperator`
@@ -121,7 +121,7 @@ pub trait PlotOperator:
121121 debug ! ( "Initialize {}, path: {}" , self . typetag_name( ) , & path) ;
122122 #[ allow( clippy:: used_underscore_items) ] // TODO: maybe rename?
123123 let op = self . _initialize ( path. clone ( ) , context) . await ?;
124- Ok ( context. wrap_initialized_plot_operator ( op, span, path ) )
124+ Ok ( context. wrap_initialized_plot_operator ( op, span) )
125125 }
126126
127127 /// Wrap a box around a `PlotOperator`
@@ -135,6 +135,7 @@ pub trait PlotOperator:
135135 fn span ( & self ) -> CreateSpan ;
136136}
137137
138+ // TODO: implement a derive macro for common fields of operators: name, path, data, result_descriptor and automatically implement common trait functions
138139pub trait InitializedRasterOperator : Send + Sync {
139140 /// Get the result descriptor of the `Operator`
140141 fn result_descriptor ( & self ) -> & RasterResultDescriptor ;
@@ -152,6 +153,17 @@ pub trait InitializedRasterOperator: Send + Sync {
152153
153154 /// Get a canonic representation of the operator and its sources
154155 fn canonic_name ( & self ) -> CanonicOperatorName ;
156+
157+ /// Get the unique name of the operator
158+ fn name ( & self ) -> & ' static str ;
159+
160+ // Get the path of the operator in the workflow
161+ fn path ( & self ) -> WorkflowOperatorPath ;
162+
163+ /// Return the name of the data loaded by the operator (if any)
164+ fn data ( & self ) -> Option < String > {
165+ None
166+ }
155167}
156168
157169pub trait InitializedVectorOperator : Send + Sync {
@@ -172,6 +184,17 @@ pub trait InitializedVectorOperator: Send + Sync {
172184 /// Get a canonic representation of the operator and its sources.
173185 /// This only includes *logical* operators, not wrappers
174186 fn canonic_name ( & self ) -> CanonicOperatorName ;
187+
188+ /// Get the unique name of the operator
189+ fn name ( & self ) -> & ' static str ;
190+
191+ // Get the path of the operator in the workflow
192+ fn path ( & self ) -> WorkflowOperatorPath ;
193+
194+ /// Return the name of the data loaded by the operator (if any)
195+ fn data ( & self ) -> Option < String > {
196+ None
197+ }
175198}
176199
177200/// A canonic name for an operator and its sources
@@ -247,6 +270,18 @@ impl InitializedRasterOperator for Box<dyn InitializedRasterOperator> {
247270 fn canonic_name ( & self ) -> CanonicOperatorName {
248271 self . as_ref ( ) . canonic_name ( )
249272 }
273+
274+ fn name ( & self ) -> & ' static str {
275+ self . as_ref ( ) . name ( )
276+ }
277+
278+ fn path ( & self ) -> WorkflowOperatorPath {
279+ self . as_ref ( ) . path ( )
280+ }
281+
282+ fn data ( & self ) -> Option < String > {
283+ self . as_ref ( ) . data ( )
284+ }
250285}
251286
252287impl InitializedVectorOperator for Box < dyn InitializedVectorOperator > {
@@ -261,6 +296,18 @@ impl InitializedVectorOperator for Box<dyn InitializedVectorOperator> {
261296 fn canonic_name ( & self ) -> CanonicOperatorName {
262297 self . as_ref ( ) . canonic_name ( )
263298 }
299+
300+ fn name ( & self ) -> & ' static str {
301+ self . as_ref ( ) . name ( )
302+ }
303+
304+ fn path ( & self ) -> WorkflowOperatorPath {
305+ self . as_ref ( ) . path ( )
306+ }
307+
308+ fn data ( & self ) -> Option < String > {
309+ self . as_ref ( ) . data ( )
310+ }
264311}
265312
266313impl InitializedPlotOperator for Box < dyn InitializedPlotOperator > {
0 commit comments