Trait Stage

Source
pub trait Stage: Clone {
    type State;

    // Required methods
    fn inputs(&self) -> &HashMap<DataLabel, (TypeId, RefType)>;
    fn outputs(&self) -> &HashMap<DataLabel, TypeId>;
    fn evaluate(
        &self,
        state: &mut Self::State,
        inputs: &mut HashMap<DataLabel, (Arc<dyn Any + Send + Sync>, ReevaluationRule)>,
        cache: &mut HashMap<u64, Vec<Cached>>,
    ) -> Result<NodeOutput, InjectionError>;
    fn inject_input(
        &self,
        node: &mut Node<Self>,
        parent: &mut Box<dyn AnyNode>,
        output: DataLabel,
        input: DataLabel,
    ) -> Result<(), InjectionError>;
    fn name(&self) -> &str;

    // 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

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 Self::State, inputs: &mut HashMap<DataLabel, (Arc<dyn Any + Send + Sync>, ReevaluationRule)>, cache: &mut HashMap<u64, Vec<Cached>>, ) -> Result<NodeOutput, InjectionError>

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<(), InjectionError>

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

Source

fn name(&self) -> &str

Stage name, used for debugging information

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§