aboutsummaryrefslogtreecommitdiff
path: root/syn/examples/trace-var/example/src/main.rs
blob: da2c10b8498f6597186cbd2bdb29c680be3e85b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use trace_var::trace_var;

fn main() {
    println!("{}", factorial(8));
}

#[trace_var(p, n)]
fn factorial(mut n: u64) -> u64 {
    let mut p = 1;
    while n > 1 {
        p *= n;
        n -= 1;
    }
    p
}