Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fn main() {
- foo(4);
- }
- fn foo(x: u32) {
- takes_function_pointer(|| println!("First")); // Ok
- takes_function_pointer(|| println!("Second: {}", x)); // Error
- }
- fn takes_function_pointer(f: fn()) {
- f()
- }
Add Comment
Please, Sign In to add comment