Skip to content

Instantly share code, notes, and snippets.

@rubber-duck
Created June 23, 2013 11:45
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 rubber-duck/5844737 to your computer and use it in GitHub Desktop.
Save rubber-duck/5844737 to your computer and use it in GitHub Desktop.
struct Foo<'self>
{
foo: &'self fn()
}
impl<'self> Foo<'self> {
fn foo(&self) {
println("Method foo");
}
}
fn main() {
let f = Foo { foo: || { println("Fn foo"); } };
let ff = f.foo;
f.foo();
ff();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment