pub trait Simulatable:
Clone
+ Send
+ Sync {
type Output: Clone + Send + Sync;
// Required methods
fn dim(&self) -> usize;
fn step(&mut self, dt: f64, dw: &[f64], rng: &mut impl Rng) -> Self::Output;
fn current(&self) -> Self::Output;
}Expand description
The central trait for all market models.
Every model – from a simple GBM to a full L3 order book simulator –
implements this trait. The SimulationRunner consumes only this trait,
so the hot path is monomorphized at compile time and pays zero overhead
for unused complexity.
The runner clones the model for each parallel path, so implementations
must be Clone.
Required Associated Types§
Required Methods§
Sourcefn dim(&self) -> usize
fn dim(&self) -> usize
Dimensionality of the Brownian driver. Used by the runner to pre-generate the correct number of random normals per step. GBM is 1, Heston is 2, etc.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".