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

Method insert

src/utils/binarytree.rs:51–78  ·  view source on GitHub ↗
(
        &mut self,
        window: Rc<RefCell<MagmaWindow>>,
        splitnew: HorizontalOrVertical,
        rationew: f32,
    )

Source from the content-addressed store, hash-verified

49 }
50
51 pub fn insert(
52 &mut self,
53 window: Rc<RefCell<MagmaWindow>>,
54 splitnew: HorizontalOrVertical,
55 rationew: f32,
56 ) {
57 match self {
58 BinaryTree::Empty => {
59 *self = BinaryTree::Window(window);
60 }
61 BinaryTree::Window(w) => {
62 *self = BinaryTree::Split {
63 left: Box::new(BinaryTree::Window(w.clone())),
64 right: Box::new(BinaryTree::Window(window)),
65 split: splitnew,
66 ratio: rationew,
67 };
68 }
69 BinaryTree::Split {
70 left: _,
71 right,
72 split: _,
73 ratio: _,
74 } => {
75 right.insert(window, splitnew, rationew);
76 }
77 }
78 }
79
80 pub fn remove(&mut self, window: &Window) {
81 match self {

Callers 6

add_windowMethod · 0.80
elementMethod · 0.80
on_device_addedMethod · 0.80
on_connector_eventMethod · 0.80
generate_configFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected