Skip to content

Instantly share code, notes, and snippets.

@jmcarthur
Created September 28, 2013 19:53
Show Gist options
  • Save jmcarthur/6745884 to your computer and use it in GitHub Desktop.
Save jmcarthur/6745884 to your computer and use it in GitHub Desktop.
A little experiment that has led to a question about lifetimes in Rust.
struct Thunk<'a, T> {
f : ~fn() -> & 'a T
}
@jmcarthur
Copy link
Author

impl Thunk {
fn force <'a> (& 'a mut self) -> & 'a T {
return (self.f) (self);
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment