MCPcopy Create free account
hub / github.com/MagmaWM/MagmaWM / remove

Method remove

src/utils/binarytree.rs:80–111  ·  view source on GitHub ↗
(&mut self, window: &Window)

Source from the content-addressed store, hash-verified

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 {

Callers 2

remove_windowMethod · 0.80
on_connector_eventMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected