pub struct SimulationEngine { /* private fields */ }Expand description
Generic simulation engine for event-driven processing
Implementations§
Source§impl SimulationEngine
impl SimulationEngine
Sourcepub fn new(config: SimulationEngineConfig) -> Self
pub fn new(config: SimulationEngineConfig) -> Self
Create a new simulation engine with the given configuration
Sourcepub fn default_config() -> Self
pub fn default_config() -> Self
Create with default configuration
Sourcepub fn run<F>(
&self,
data: &[ValueWord],
handler: F,
) -> Result<SimulationEngineResult>
pub fn run<F>( &self, data: &[ValueWord], handler: F, ) -> Result<SimulationEngineResult>
Run simulation over a sequence of values
The handler is called for each value with (value, current_state, index) and returns a StepResult containing the new state and any events.
Sourcepub fn run_with_hooks<F, Pre, Post>(
&self,
data: &[ValueWord],
pre_process: Pre,
handler: F,
post_process: Post,
) -> Result<SimulationEngineResult>where
F: Fn(&ValueWord, &ValueWord, usize) -> Result<StepResult>,
Pre: Fn(&ValueWord) -> Result<ValueWord>,
Post: Fn(SimulationEngineResult) -> Result<SimulationEngineResult>,
pub fn run_with_hooks<F, Pre, Post>(
&self,
data: &[ValueWord],
pre_process: Pre,
handler: F,
post_process: Post,
) -> Result<SimulationEngineResult>where
F: Fn(&ValueWord, &ValueWord, usize) -> Result<StepResult>,
Pre: Fn(&ValueWord) -> Result<ValueWord>,
Post: Fn(SimulationEngineResult) -> Result<SimulationEngineResult>,
Run simulation with pre-processing and post-processing hooks
Auto Trait Implementations§
impl Freeze for SimulationEngine
impl RefUnwindSafe for SimulationEngine
impl Send for SimulationEngine
impl Sync for SimulationEngine
impl Unpin for SimulationEngine
impl UnsafeUnpin for SimulationEngine
impl UnwindSafe for SimulationEngine
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more