Trait Model

Source
pub trait Model {
    type Input;
    type Output;
    type Error: Error + Send + Sync + 'static;

    // Required method
    fn call(&self, input: Self::Input) -> Result<Self::Output, Self::Error>;
}
Expand description

Trait for defining a system model in Twine.

Models represent systems with clear boundaries defined by typed inputs and outputs. They must be deterministic, always producing the same result for a given input, which enables time evolution using a Simulation.

Required Associated Types§

Source

type Input

Source

type Output

Source

type Error: Error + Send + Sync + 'static

Required Methods§

Source

fn call(&self, input: Self::Input) -> Result<Self::Output, Self::Error>

Calls the model with the given input and returns a result.

§Errors

Each model defines its own Error type, allowing it to determine what constitutes a failure within its domain.

Implementors§