Replay Composition
Function Step Replay
Call and Return
A function call is a compact replay composition: the caller pauses, the callee produces a value, and the caller continues with the result.
Program
Play the program to choose a request count and watch the replay move through the helper before returning to main.
function_step_replay_rust.rs
fn score_bonus(count: i32) -> i32 {
let points = count * 2;
points
}
fn main() {
let request_count = ;
let base_score = 10;
let bonus = score_bonus(request_count);
let total = base_score + bonus;
println!("{request_count}:{total}");
}
fn score_bonus(count: i32) -> i32 {
let points = count * 2;
points
}
fn main() {
let request_count = ;
let base_score = 10;
let bonus = score_bonus(request_count);
let total = base_score + bonus;
println!("{request_count}:{total}");
}
fn score_bonus(count: i32) -> i32 {
let points = count * 2;
points
}
fn main() {
let request_count = ;
let base_score = 10;
let bonus = score_bonus(request_count);
let total = base_score + bonus;
println!("{request_count}:{total}");
}
callee state
The helper owns `count` and `points` while it runs.
return value
The last expression returns the computed points to the caller.
single stream
The replay is still one source panel and one ordered event stream.