pub fn simulate_video_with_progress(
path: &Path,
config: SimulatorConfig,
scale: Option<(usize, usize)>,
max_frames: Option<usize>,
on_events: impl FnMut(EventStream) -> Result<()>,
on_progress: impl FnMut(SimulateProgress) -> Result<()>,
) -> Result<(usize, usize)>Expand description
simulate_video, reporting after every frame.
Split out rather than folded in because a simulation is long enough that a caller needs to see
it moving, and there is nothing else in the loop that knows the frame count. on_progress
returns a Result so that the same hook can stop the run — a caller polling for Ctrl+C has
nowhere else to do it, since a whole simulation is one uninterruptible call otherwise.