Skip to content

Instantly share code, notes, and snippets.

@TethysSvensson
Created June 23, 2014 18:44
Show Gist options
  • Save TethysSvensson/c44b405d97aabaea4231 to your computer and use it in GitHub Desktop.
Save TethysSvensson/c44b405d97aabaea4231 to your computer and use it in GitHub Desktop.
fn foo(n: &u64) -> proc() -> u64 {
proc() { *n }
}
fn mk_foo(n: u64) -> proc() -> u64 {
foo(&n)
}
fn main() {
let x = mk_foo(1);
let y = mk_foo(2);
println!("{}", x());
println!("{:x}", y());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment