Skip to content

Instantly share code, notes, and snippets.

@SPY
Created April 13, 2013 12:30
Show Gist options
  • Save SPY/5378202 to your computer and use it in GitHub Desktop.
Save SPY/5378202 to your computer and use it in GitHub Desktop.
i have error rbtree.rs:53:24: 53:33 error: assigning to mutable field prohibited due to outstanding loan rbtree.rs:53 None => self.left = Some(self.make_child(k, v)) ^~~~~~~~~ rbtree.rs:51:18: 51:27 note: loan of mutable field granted here rbtree.rs:51 match self.left { ^~~~~~~~~
pub fn insert(&mut self, k: K, v: V) {
if k < self.key {
match self.left {
Some(ref mut l) => l.insert(k, v),
None => self.left = Some(self.make_child(k, v))
}
}
else if k > self.key {
match self.right {
Some(ref mut r) => r.insert(k, v),
None => self.right = Some(self.make_child(k, v))
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment