MCPcopy Index your code
hub / github.com/douchuan/algorithm / insert

Method insert

src/tree/binary/rb2.rs:125–130  ·  view source on GitHub ↗
(&mut self, key: K, val: V)

Source from the content-addressed store, hash-verified

123 K: Ord,
124{
125 fn insert(&mut self, key: K, val: V) {
126 let new_root = put(self.root, key, val);
127 NodeQuery::new(new_root).set_color(Color::Black);
128 self.root = new_root;
129 self.set_size(bst::calc_size(self.root));
130 }
131
132 fn get(&self, key: &K) -> Option<&V> {
133 unsafe { bst::find(self.root, key).and_then(|p| p.as_ref().val.as_ref()) }

Callers 2

t_verifyFunction · 0.45
t_calc_sizeFunction · 0.45

Calls 4

putFunction · 0.85
calc_sizeFunction · 0.85
set_colorMethod · 0.80
set_sizeMethod · 0.80

Tested by 2

t_verifyFunction · 0.36
t_calc_sizeFunction · 0.36