Guest User

Untitled

a guest
Jan 23rd, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.21 KB | None | 0 0
  1. fn main() {
  2. foo(4);
  3. }
  4.  
  5. fn foo(x: u32) {
  6. takes_function_pointer(|| println!("First")); // Ok
  7. takes_function_pointer(|| println!("Second: {}", x)); // Error
  8. }
  9.  
  10. fn takes_function_pointer(f: fn()) {
  11. f()
  12. }
Add Comment
Please, Sign In to add comment