pub struct SimEngine<'a> {
queue: &'a mut EventQueue,
state: SimState,
telemetry: &'a mut TelemetryAccumulator,
handler: &'a mut dyn SpecHandler,
sink: &'a mut TelemetrySink,
encounter_end_ms: u32,
pending_player_ready: Option<SimTime>,
}Expand description
Event loop for a single sim iteration; queue and handler are borrowed for reuse across iterations.
Fields§
§queue: &'a mut EventQueue§state: SimState§telemetry: &'a mut TelemetryAccumulator§handler: &'a mut dyn SpecHandler§sink: &'a mut TelemetrySink§encounter_end_ms: u32§pending_player_ready: Option<SimTime>Implementations§
Source§impl<'a> SimEngine<'a>
impl<'a> SimEngine<'a>
Sourcepub fn new(state: SimState, refs: SimEngineRefs<'a>) -> Self
pub fn new(state: SimState, refs: SimEngineRefs<'a>) -> Self
Construct an iteration engine over caller-owned reusable state; the caller clears the queue and resets the handler first.
Sourcepub fn run(&mut self) -> Result<()>
pub fn run(&mut self) -> Result<()>
Execute one iteration to completion and record telemetry.
§Errors
Returns an error if the event budget is exceeded or the spec handler fails.
Sourcepub fn capture_representative(&mut self) -> Result<()>
pub fn capture_representative(&mut self) -> Result<()>
Deterministically rerun one selected iteration and install only its representative trace, leaving aggregates unchanged.
§Errors
Returns an error if the event budget is exceeded or the spec handler fails.
fn run_with_mode(&mut self, mode: RunMode) -> Result<()>
fn push_player_ready(&mut self, t: SimTime)
fn handle_event(&mut self, event: Event, t: SimTime) -> Result<()>
fn handle_player_ready_event(&mut self, t: SimTime) -> Result<()>
fn handle_player_ready(&mut self, t: SimTime) -> Result<()>
fn dispatch( &mut self, f: impl FnOnce(&mut dyn SpecHandler, &mut SimContext<'_>), ) -> Result<()>
fn check_handler_error(&mut self) -> Result<()>
fn finalize(&mut self, completed_at: SimTime, mode: RunMode)
fn debug_assert_damage_telemetry_reconciled( &self, combat_total: f64, completed_at: SimTime, mode: RunMode, )
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for SimEngine<'a>
impl<'a> !RefUnwindSafe for SimEngine<'a>
impl<'a> Send for SimEngine<'a>
impl<'a> !Sync for SimEngine<'a>
impl<'a> Unpin for SimEngine<'a>
impl<'a> UnsafeUnpin for SimEngine<'a>
impl<'a> !UnwindSafe for SimEngine<'a>
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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