MCPcopy Create free account
hub / github.com/douchuan/algorithm / replace

Method replace

src/tree/binary/node.rs:165–175  ·  view source on GitHub ↗
(&mut self, node: Option<NonNull<Node<K, V>>>)

Source from the content-addressed store, hash-verified

163 }
164
165 pub fn replace(&mut self, node: Option<NonNull<Node<K, V>>>) {
166 if self.parent().is_none() {
167 if let Some(mut node) = node {
168 unsafe { node.as_mut().parent = None }
169 }
170 } else if self.i_am_left() {
171 self.parent().set_left(node);
172 } else {
173 self.parent().set_right(node);
174 }
175 }
176
177 pub fn set_entry(&mut self, (key, val): (K, Option<V>)) {
178 if let Some(mut node) = self.node {

Callers 2

rotate_leftFunction · 0.80
rotate_rightFunction · 0.80

Calls 5

is_noneMethod · 0.80
parentMethod · 0.80
i_am_leftMethod · 0.80
set_leftMethod · 0.45
set_rightMethod · 0.45

Tested by

no test coverage detected