Skip to content

Instantly share code, notes, and snippets.

@aturon
Created November 6, 2014 15:55
Show Gist options
  • Save aturon/bf84ef392ee6512aada3 to your computer and use it in GitHub Desktop.
Save aturon/bf84ef392ee6512aada3 to your computer and use it in GitHub Desktop.
fn nth(&mut self, mut n: uint) -> Option<A> {
for x in *self {
if n == 0 { return Some(x) }
n -= 1;
}
None
}
error: cannot borrow immutable local variable `self` as mutable
for x in *self {
^~~~~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment