Skip to content

Commit 4adf897

Browse files
committed
Force inlining of methods on internal implementation of LayoutTree
1 parent e61872f commit 4adf897

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/node.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,18 +76,22 @@ impl Default for Taffy {
7676
impl LayoutTree for Taffy {
7777
type ChildIter<'a> = core::slice::Iter<'a, DefaultKey>;
7878

79+
#[inline(always)]
7980
fn children(&self, node: Node) -> Self::ChildIter<'_> {
8081
self.children[node].iter()
8182
}
8283

84+
#[inline(always)]
8385
fn child_count(&self, node: Node) -> usize {
8486
self.children[node].len()
8587
}
8688

89+
#[inline(always)]
8790
fn style(&self, node: Node) -> &Style {
8891
&self.nodes[node].style
8992
}
9093

94+
#[inline(always)]
9195
fn layout_mut(&mut self, node: Node) -> &mut Layout {
9296
&mut self.nodes[node].layout
9397
}
@@ -114,10 +118,12 @@ impl LayoutTree for Taffy {
114118
&mut self.nodes[node].size_cache[index]
115119
}
116120

121+
#[inline(always)]
117122
fn child(&self, node: Node, id: usize) -> Node {
118123
self.children[node][id]
119124
}
120125

126+
#[inline(always)]
121127
fn measure_child_size(
122128
&mut self,
123129
node: Node,
@@ -129,6 +135,7 @@ impl LayoutTree for Taffy {
129135
GenericAlgorithm::measure_size(self, node, known_dimensions, parent_size, available_space, sizing_mode)
130136
}
131137

138+
#[inline(always)]
132139
fn perform_child_layout(
133140
&mut self,
134141
node: Node,

0 commit comments

Comments
 (0)