Capacity reports are easier to inspect when the margin and label are printed together. This program classifies a fixed capacity against selected demand.

Program

Play the program to choose demand and watch the reserve move from stable to watch to tight.

demand
capacity_margin_report.rs
Replay: real traced execution (multi-file project)
fn main() {
    let demand = 72;
    let capacity = 100;
    let reserve = capacity - demand;
    let status = if reserve >= 25 {
        "stable"
    } else if reserve >= 10 {
        "watch"
    } else {
        "tight"
    };
    let line = format!("{demand} {reserve} {status}");
    println!("{line}");
}
fn main() {
    let demand = 88;
    let capacity = 100;
    let reserve = capacity - demand;
    let status = if reserve >= 25 {
        "stable"
    } else if reserve >= 10 {
        "watch"
    } else {
        "tight"
    };
    let line = format!("{demand} {reserve} {status}");
    println!("{line}");
}
fn main() {
    let demand = 95;
    let capacity = 100;
    let reserve = capacity - demand;
    let status = if reserve >= 25 {
        "stable"
    } else if reserve >= 10 {
        "watch"
    } else {
        "tight"
    };
    let line = format!("{demand} {reserve} {status}");
    println!("{line}");
}
  1. demand ← 72, capacity ← 100, reserve ← 28, status ← "stable", line ← "72 28 stable"

    1fn main() {2    let deman→ 72d = 72; //@demand=72, 88, 953    let capacit→ 100y = 100;4    let reserv→ 28e = capacit100y - deman72d;5    let statu→ "stable"s = if reserv28e >= 25 {6        "stable"7    } else if reserv28e >= 10 {8        "watch"9    } else {10        "tight"11    };12    let lin→ "72 28 stable"e = format!("{demand} {reserve} {status}");13    println!("{line}");14}
    output72 28 stable
  1. demand ← 88, capacity ← 100, reserve ← 12, status ← "watch", line ← "88 12 watch"

    1fn main() {2    let deman→ 88d = 88;3    let capacit→ 100y = 100;4    let reserv→ 12e = capacit100y - deman88d;5    let statu→ "watch"s = if reserv12e >= 25 {6        "stable"7    } else if reserv12e >= 10 {8        "watch"9    } else {10        "tight"11    };12    let lin→ "88 12 watch"e = format!("{demand} {reserve} {status}");13    println!("{line}");14}
    output88 12 watch
  1. demand ← 95, capacity ← 100, reserve ← 5, status ← "tight", line ← "95 5 tight"

    1fn main() {2    let deman→ 95d = 95;3    let capacit→ 100y = 100;4    let reserv→ 5e = capacit100y - deman95d;5    let statu→ "tight"s = if reserv5e >= 25 {6        "stable"7    } else if reserv5e >= 10 {8        "watch"9    } else {10        "tight"11    };12    let lin→ "95 5 tight"e = format!("{demand} {reserve} {status}");13    println!("{line}");14}
    output95 5 tight
reserve `reserve` is derived from capacity minus current demand.
classification The branch labels the margin as stable, watch, or tight.
deterministic inputs Capacity is a fixed fixture and demand is the only selector.