(&mut self, window: &Window)
| 78 | } |
| 79 | |
| 80 | pub fn remove(&mut self, window: &Window) { |
| 81 | match self { |
| 82 | BinaryTree::Empty => {} |
| 83 | BinaryTree::Window(w) => { |
| 84 | // Should only happen if this is the root |
| 85 | if w.borrow().window == *window { |
| 86 | *self = BinaryTree::Empty; |
| 87 | } |
| 88 | } |
| 89 | BinaryTree::Split { |
| 90 | left, |
| 91 | right, |
| 92 | split: _, |
| 93 | ratio: _, |
| 94 | } => { |
| 95 | if let BinaryTree::Window(w) = left.as_ref() { |
| 96 | if w.borrow().window == *window { |
| 97 | *self = *right.clone(); |
| 98 | return; |
| 99 | } |
| 100 | } |
| 101 | if let BinaryTree::Window(w) = right.as_ref() { |
| 102 | if w.borrow().window == *window { |
| 103 | *self = *left.clone(); |
| 104 | return; |
| 105 | } |
| 106 | } |
| 107 | left.remove(window); |
| 108 | right.remove(window); |
| 109 | } |
| 110 | } |
| 111 | } |
| 112 | |
| 113 | pub fn next_split(&self) -> HorizontalOrVertical { |
| 114 | match self { |
no outgoing calls
no test coverage detected