Skip to content

Instantly share code, notes, and snippets.

Created August 28, 2015 07:07
Show Gist options
  • Save anonymous/b5850cf7d78cae3a2b86 to your computer and use it in GitHub Desktop.
Save anonymous/b5850cf7d78cae3a2b86 to your computer and use it in GitHub Desktop.
Shared via Rust Playground
//function pointer
fn foo(x: i32) -> i32 {
return x+1;
}
fn main() {
let mut x: fn(i32) -> i32 = foo;
// or x = foo;
println!("{}", x(10));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment