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§
Sourceconst SHAPE: StageShape
const SHAPE: StageShape
Used for reflection
Required Associated Types§
Sourcetype State: Send + Sync
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
Required Methods§
Sourcefn evaluate(
&self,
state: &mut Self::State,
inputs: &mut Self::Input,
cache: &mut HashMap<u64, Vec<Cached<Self>>>,
) -> Result<Self::Output, InjectionError>
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
Sourcefn inject_input(
&self,
node: &mut Node<Self>,
parent: &mut Box<dyn AnyNode>,
output: Option<&'static str>,
input: Option<&'static str>,
) -> Result<(), InjectionError>
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§
fn reeval_rule(&self) -> ReevaluationRule
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
impl Stage for ()
Empty version of a stage. Does nothing