有没有办法让闭包递归调用,例如:
fn main() {
let recurse = |x: i32| {
println!("{}", x);
let x_next = x + 1;
if x < 10 {
recurse(x_next); // commenting this line will build
}
x_next;
};
recurse(1);
}
有没有办法解决闭包体中未定义的闭包?