Skip to content

Instantly share code, notes, and snippets.

@jpastuszek
Forked from anonymous/playground.rs
Last active August 29, 2015 14:27
Show Gist options
  • Save jpastuszek/84b64edcca1421bd2a23 to your computer and use it in GitHub Desktop.
Save jpastuszek/84b64edcca1421bd2a23 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);
}));
println!("after: {}", s);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment