Skip to content

Instantly share code, notes, and snippets.

@MaikKlein
Created May 23, 2013 16:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MaikKlein/5637473 to your computer and use it in GitHub Desktop.
Save MaikKlein/5637473 to your computer and use it in GitHub Desktop.
fn unwrap(f: &fn() -> Option<int>) -> Option<int>{
f()
}
fn main() {
let c = unwrap(|| {
let a = Some(2);
let b = Some(3);
a + b
});
println(fmt!("%?", c));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment