⎇ 9e53f03adea2b770d68954e404d2fa407dfc7d40
benches/generated/display_none_with_margin.rs
Historia
Quién tocó qué
crudo
Layout algorithm decoupling, Sizing Constraints & Perf Improvements (#246)
1pub fn compute() {
2 let mut taffy = taffy::Taffy::new();
3 let node0 = taffy
4 .new_with_children(
5 taffy::style::FlexboxLayout {
6 display: taffy::style::Display::None,
7 size: taffy::geometry::Size {
8 width: taffy::style::Dimension::Points(20f32),
9 height: taffy::style::Dimension::Points(20f32),
10 ..Default::default()
11 },
12 margin: taffy::geometry::Rect {
13 start: taffy::style::Dimension::Points(10f32),
14 end: taffy::style::Dimension::Points(10f32),
15 top: taffy::style::Dimension::Points(10f32),
16 bottom: taffy::style::Dimension::Points(10f32),
17 ..Default::default()
18 },
19 ..Default::default()
20 },
21 &[],
22 )
23 .unwrap();
24 let node1 =
25 taffy.new_with_children(taffy::style::FlexboxLayout { flex_grow: 1f32, ..Default::default() }, &[]).unwrap();
26 let node = taffy
27 .new_with_children(
28 taffy::style::FlexboxLayout {
29 size: taffy::geometry::Size {
30 width: taffy::style::Dimension::Points(100f32),
31 height: taffy::style::Dimension::Points(100f32),
32 ..Default::default()
33 },
34 ..Default::default()
35 },
36 &[node0, node1],
37 )
38 .unwrap();
39 taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
40}