pub trait AnyNode: Any {
// Required methods
fn into_any(self: Box<Self>) -> Box<dyn Any>;
fn as_any(&self) -> &dyn Any;
fn eval(&mut self) -> Result<HashMap<DataLabel, Arc<dyn Any + Send + Sync>>>;
fn eval_strategy(&self) -> EvalStrategy;
fn reeval_rule(&self) -> ReevaluationRule;
fn replace_output(
&mut self,
key: &DataLabel,
output: Arc<dyn Any + Send + Sync>,
) -> Result<Option<Arc<dyn Any + Send + Sync>>>;
fn flow_data(
&mut self,
parent: &mut Box<dyn AnyNode>,
output: DataLabel,
input: DataLabel,
) -> Result<(), Error>;
fn inputs_mut(
&mut self,
) -> &mut HashMap<DataLabel, (Arc<dyn Any + Send + Sync>, ReevaluationRule)>;
fn outputs_mut(
&mut self,
) -> &mut HashMap<DataLabel, Arc<dyn Any + Send + Sync>>;
fn input_reftype(&self, name: &DataLabel) -> Option<RefType>;
fn set_input_changed(&mut self, val: bool);
fn input_changed(&self) -> bool;
}Expand description
This is used to type-erase a node. It’s public because the macro needs to use this, but there should be no reason anyone should manually implement this.
Required Methods§
Sourcefn into_any(self: Box<Self>) -> Box<dyn Any>
fn into_any(self: Box<Self>) -> Box<dyn Any>
Upcast to dyn Any to get its more-specific downcast capabilities
Sourcefn eval(&mut self) -> Result<HashMap<DataLabel, Arc<dyn Any + Send + Sync>>>
fn eval(&mut self) -> Result<HashMap<DataLabel, Arc<dyn Any + Send + Sync>>>
Evaluates the node. Returns a map of prior outputs
fn eval_strategy(&self) -> EvalStrategy
fn reeval_rule(&self) -> ReevaluationRule
Sourcefn replace_output(
&mut self,
key: &DataLabel,
output: Arc<dyn Any + Send + Sync>,
) -> Result<Option<Arc<dyn Any + Send + Sync>>>
fn replace_output( &mut self, key: &DataLabel, output: Arc<dyn Any + Send + Sync>, ) -> Result<Option<Arc<dyn Any + Send + Sync>>>
Set the outputs and return any existing outputs.
Sourcefn flow_data(
&mut self,
parent: &mut Box<dyn AnyNode>,
output: DataLabel,
input: DataLabel,
) -> Result<(), Error>
fn flow_data( &mut self, parent: &mut Box<dyn AnyNode>, output: DataLabel, input: DataLabel, ) -> Result<(), Error>
This a a core part of the plumbing of this crate - take the outputs of a parent node and use them to set the inputs of a child node.
Sourcefn inputs_mut(
&mut self,
) -> &mut HashMap<DataLabel, (Arc<dyn Any + Send + Sync>, ReevaluationRule)>
fn inputs_mut( &mut self, ) -> &mut HashMap<DataLabel, (Arc<dyn Any + Send + Sync>, ReevaluationRule)>
Used to support [Self::flow_data]
Sourcefn outputs_mut(&mut self) -> &mut HashMap<DataLabel, Arc<dyn Any + Send + Sync>>
fn outputs_mut(&mut self) -> &mut HashMap<DataLabel, Arc<dyn Any + Send + Sync>>
Used to support [Self::flow_data]
Sourcefn input_reftype(&self, name: &DataLabel) -> Option<RefType>
fn input_reftype(&self, name: &DataLabel) -> Option<RefType>
Look of the reftype of a particular input
Sourcefn set_input_changed(&mut self, val: bool)
fn set_input_changed(&mut self, val: bool)
Used to indicate that an input has been modified from a previous run.
Sourcefn input_changed(&self) -> bool
fn input_changed(&self) -> bool
See [Self::set_input_changed]