box-o-sand/rustbyexample/fn.d/closures.d/anonymity.rs

15 lines
138 B
Rust
Raw Normal View History

2023-10-19 15:08:38 +00:00
fn apply<F>(f: F)
where
F: Fn(),
{
f();
}
fn main() {
let x = 7;
let print = || println!("{}", x);
apply(print);
}