A few more RBE things
This commit is contained in:
14
rustbyexample/fn.d/closures.d/anonymity.rs
Normal file
14
rustbyexample/fn.d/closures.d/anonymity.rs
Normal file
@@ -0,0 +1,14 @@
|
||||
fn apply<F>(f: F)
|
||||
where
|
||||
F: Fn(),
|
||||
{
|
||||
f();
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let x = 7;
|
||||
|
||||
let print = || println!("{}", x);
|
||||
|
||||
apply(print);
|
||||
}
|
Reference in New Issue
Block a user