pub struct ReplayRunner<S, F>{ /* private fields */ }Expand description
A generic replay runner parameterized on user state type S.
The user provides a sim_fn that takes (seed, target_tick) and returns
(state, trace). The replay runner uses this to implement time-travel
debugging primitives.
use vortex_trace::replay::ReplayRunner;
use vortex_trace::SimTrace;
// Example: replay a simple counter simulation
let runner = ReplayRunner::new(42, |seed, ticks| {
let mut trace = SimTrace::new();
let mut counter = 0u64;
for t in 0..ticks {
counter += 1;
// Record events to trace as needed
}
(counter, trace)
});
let (state, _trace) = runner.replay_to_tick(100);
assert_eq!(state, 100);Implementations§
Source§impl<S, F> ReplayRunner<S, F>
impl<S, F> ReplayRunner<S, F>
Sourcepub fn new(seed: u64, sim_fn: F) -> Self
pub fn new(seed: u64, sim_fn: F) -> Self
Create a new replay runner.
seed: the deterministic seed for the simulationsim_fn:(seed, target_tick) -> (state, trace)
Sourcepub fn replay_to_tick(&self, target_tick: u64) -> (S, SimTrace)
pub fn replay_to_tick(&self, target_tick: u64) -> (S, SimTrace)
Replay the simulation to a specific tick.
Creates a fresh simulation from the seed and runs to target_tick.
Sourcepub fn replay_window(
&self,
start_tick: u64,
end_tick: u64,
) -> (S, Vec<TraceEvent>)
pub fn replay_window( &self, start_tick: u64, end_tick: u64, ) -> (S, Vec<TraceEvent>)
Replay a window: run to end_tick, return events in [start_tick, end_tick].
Auto Trait Implementations§
impl<S, F> Freeze for ReplayRunner<S, F>where
F: Freeze,
impl<S, F> RefUnwindSafe for ReplayRunner<S, F>where
F: RefUnwindSafe,
S: RefUnwindSafe,
impl<S, F> Send for ReplayRunner<S, F>
impl<S, F> Sync for ReplayRunner<S, F>
impl<S, F> Unpin for ReplayRunner<S, F>
impl<S, F> UnsafeUnpin for ReplayRunner<S, F>where
F: UnsafeUnpin,
impl<S, F> UnwindSafe for ReplayRunner<S, F>where
F: UnwindSafe,
S: UnwindSafe,
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