MCPcopy Create free account
hub / github.com/d0iasm/saba / convert_layout_tree_to_string_internal

Function convert_layout_tree_to_string_internal

core/src/utils.rs:60–82  ·  view source on GitHub ↗
(
    node: &Option<Rc<RefCell<LayoutObject>>>,
    depth: usize,
    result: &mut String,
)

Source from the content-addressed store, hash-verified

58}
59
60fn convert_layout_tree_to_string_internal(
61 node: &Option<Rc<RefCell<LayoutObject>>>,
62 depth: usize,
63 result: &mut String,
64) {
65 match node {
66 Some(n) => {
67 result.push_str(&" ".repeat(depth));
68 //result.push_str(&format!("{:?} {:?}", n.borrow().kind(), n.borrow().style()));
69 result.push_str(&format!(
70 "{:?} {:?} {:?} {:?}",
71 n.borrow().kind(),
72 n.borrow().size(),
73 n.borrow().point(),
74 n.borrow().node_kind(),
75 ));
76 result.push('\n');
77 convert_layout_tree_to_string_internal(&n.borrow().first_child(), depth + 1, result);
78 convert_layout_tree_to_string_internal(&n.borrow().next_sibling(), depth, result);
79 }
80 None => (),
81 }
82}
83
84/// for debug
85pub fn convert_ast_to_string(program: &Program) -> String {

Callers 1

Calls 2

first_childMethod · 0.45
next_siblingMethod · 0.45

Tested by

no test coverage detected