Created
April 13, 2013 12:30
-
-
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 { ^~~~~~~~~
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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