Skip to content

Instantly share code, notes, and snippets.

@jbclements
Created February 15, 2013 18:57
Show Gist options
  • Save jbclements/4962504 to your computer and use it in GitHub Desktop.
Save jbclements/4962504 to your computer and use it in GitHub Desktop.
How to make the borrow live long enough?
pub struct AStruct {
x : uint
}
pub enum HasAStruct {
A(~AStruct)
}
pub fn getAStruct(a: &lt/HasAStruct) -> &lt/AStruct {
match *a {
A (s) => &(*s),
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment