Stage

Trait Stage 

Source
pub trait Stage: Clone + 'static {
    type State: Send + Sync;
    type Input: Send + Sync + Default + DynFields;
    type Output: Send + Sync + Default + DynFields;

    const SHAPE: StageShape;

    // Required methods
    fn evaluate(
        &self,
        state: &mut Self::State,
        inputs: &mut Self::Input,
        cache: &mut HashMap<u64, Vec<Cached<Self>>>,
    ) -> Result<Self::Output, InjectionError>;
    fn inject_input(
        &self,
        node: &mut Node<Self>,
        parent: &mut Box<dyn AnyNode>,
        output: Option<&'static str>,
        input: Option<&'static str>,
    ) -> Result<(), InjectionError>;

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

Defines all the information about how a stage is handled.

Required Associated Constants§

Source

const SHAPE: StageShape

Used for reflection

Required Associated Types§

Source

type State: Send + Sync

Internal state only, no special rules apply to this. This is stored as a tuple of all state parameters in order. TODO: Should be possible to relax Send+Sync bounds in sync contexts

Source

type Input: Send + Sync + Default + DynFields

The input of this stage TODO: Should be possible to relax Send+Sync bounds in sync contexts

Source

type Output: Send + Sync + Default + DynFields

The output of this stage TODO: Should be possible to relax Send+Sync bounds in sync contexts

Required Methods§

Source

fn evaluate( &self, state: &mut Self::State, inputs: &mut Self::Input, cache: &mut HashMap<u64, Vec<Cached<Self>>>, ) -> Result<Self::Output, 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: Option<&'static str>, input: Option<&'static str>, ) -> Result<(), InjectionError>

Stage-level connection processing logic. See Node::flow_data for more 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.

Implementations on Foreign Types§

Source§

impl Stage for ()

Empty version of a stage. Does nothing

Source§

const SHAPE: StageShape

Source§

type State = ()

Source§

type Input = ()

Source§

type Output = ()

Source§

fn evaluate( &self, _: &mut Self::State, _: &mut Self::Input, _: &mut HashMap<u64, Vec<Cached<Self>>>, ) -> Result<Self::Output, InjectionError>

Source§

fn inject_input( &self, _: &mut Node<Self>, _: &mut Box<dyn AnyNode>, _: Option<&'static str>, _: Option<&'static str>, ) -> Result<(), InjectionError>

Implementors§