Function
replace_node
(
tree: &mut RBTree<K, V>,
parent: *mut RBNode<K, V>,
node: *mut RBNode<K, V>,
new: *mut RBNode<K, V>)
Source from the content-addressed store, hash-verified
| 878 | // 替换节点值并更新节点关系 |
| 879 | #[inline] |
| 880 | unsafe fn replace_node<K: Ord + Debug, V>( |
| 881 | tree: &mut RBTree<K, V>, |
| 882 | parent: *mut RBNode<K, V>, |
| 883 | node: *mut RBNode<K, V>, |
| 884 | new: *mut RBNode<K, V>) |
| 885 | { |
| 886 | if parent.is_null() { |
| 887 | tree.root = new; |
| 888 | } else if (*parent).left == node { |
| 889 | (*parent).left = new; |
| 890 | } else { |
| 891 | (*parent).right = new; |
| 892 | } |
| 893 | } |
| 894 | |
| 895 | fn main() { |
| 896 | fn basic() { |
Tested by
no test coverage detected