Skip to content

Instantly share code, notes, and snippets.

@bvssvni
Created February 28, 2014 03:11
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 bvssvni/9264437 to your computer and use it in GitHub Desktop.
Save bvssvni/9264437 to your computer and use it in GitHub Desktop.
pub struct Test<'a> {
function: 'a ||
}
fn main() {
// x outlives 'test.function' because of lifetime constraint.
let x = 42;
let sayhello = || println!("{}", x);
let test = Test { function: sayhello };
(test.function)();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment