Trait Stage

Source
pub trait Stage: Clone {
    type State;
    type BaseFn;

    // Required methods
    fn inputs(&self) -> &HashMap<DataLabel, (TypeId, RefType)>;
    fn outputs(&self) -> &HashMap<DataLabel, TypeId>;
    fn evaluate(
        &self,
        state: &mut Option<Self::State>,
        inputs: &mut HashMap<DataLabel, (Arc<dyn Any + Send + Sync>, ReevaluationRule)>,
    ) -> Result<NodeOutput>;
    fn inject_input(
        &self,
        node: &mut Node<Self>,
        parent: &mut Box<dyn AnyNode>,
        output: DataLabel,
        input: DataLabel,
    ) -> Result<(), Error>;
    fn get_fn() -> Self::BaseFn;

    // Provided methods
    fn eval_strategy(&self) -> EvalStrategy { ... }
    fn reeval_rule(&self) -> ReevaluationRule { ... }
}
Expand description

Defines all the information about how a stage is handled.

Required Associated Types§

Source

type State

Internal state only, no special rules apply to this

Source

type BaseFn

The base function for this stage

Required Methods§

Source

fn inputs(&self) -> &HashMap<DataLabel, (TypeId, RefType)>

Used for typechecking inputs.

Source

fn outputs(&self) -> &HashMap<DataLabel, TypeId>

Used for typechecking outputs

Source

fn evaluate( &self, state: &mut Option<Self::State>, inputs: &mut HashMap<DataLabel, (Arc<dyn Any + Send + Sync>, ReevaluationRule)>, ) -> Result<NodeOutput>

Evaluate the stage with the given input and state

Source

fn inject_input( &self, node: &mut Node<Self>, parent: &mut Box<dyn AnyNode>, output: DataLabel, input: DataLabel, ) -> Result<(), Error>

Stage-level connection processing logic. See Node::flow_data for more information.

Source

fn get_fn() -> Self::BaseFn

Pointer to the function this wraps

Provided Methods§

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§