Skip to content

Instantly share code, notes, and snippets.

Created August 19, 2015 12:09
Show Gist options
  • Save anonymous/1a54c87d33081b3c7e39 to your computer and use it in GitHub Desktop.
Save anonymous/1a54c87d33081b3c7e39 to your computer and use it in GitHub Desktop.
Shared via Rust Playground
fn test<'a>(f: Box<Fn() -> () + 'a>) {
f()
}
fn main() {
let s = "xyz".to_owned();
test(Box::new(|| {
println!("blah: {}", s);
}));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment