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

Method uncle

src/tree/binary/node.rs:103–117  ·  view source on GitHub ↗
(node: Option<NonNull<Self>>)

Source from the content-addressed store, hash-verified

101 }
102
103 pub fn uncle(node: Option<NonNull<Self>>) -> Option<NonNull<Self>> {
104 unsafe {
105 node.and_then(|node| {
106 node.as_ref().parent.and_then(|parent| {
107 parent.as_ref().parent.and_then(|grandparent| {
108 if grandparent.as_ref().left == Some(parent) {
109 grandparent.as_ref().right
110 } else {
111 grandparent.as_ref().left
112 }
113 })
114 })
115 })
116 }
117 }
118}
119
120/// Node proxy, like jQuery

Callers 1

insert_fixFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected