⎇ a380b58cb0418ea3728af9a67d188410c6c10f7a
benches/generated/wrap_nodes_with_content_sizing_overflowing_margin.rs
Ñawpa willay
Pi imata llamkarqan
ch'uya
Update all benchmarks to use the new API
1pub fn compute() {
2 let mut stretch = stretch::Stretch::new();
3 let node000 = stretch
4 .new_node(
5 stretch::style::Style {
6 size: stretch::geometry::Size {
7 width: stretch::style::Dimension::Points(40f32),
8 height: stretch::style::Dimension::Points(40f32),
9 ..Default::default()
10 },
11 ..Default::default()
12 },
13 &[],
14 )
15 .unwrap();
16 let node00 = stretch
17 .new_node(
18 stretch::style::Style { flex_direction: stretch::style::FlexDirection::Column, ..Default::default() },
19 &[node000],
20 )
21 .unwrap();
22 let node010 = stretch
23 .new_node(
24 stretch::style::Style {
25 size: stretch::geometry::Size {
26 width: stretch::style::Dimension::Points(40f32),
27 height: stretch::style::Dimension::Points(40f32),
28 ..Default::default()
29 },
30 ..Default::default()
31 },
32 &[],
33 )
34 .unwrap();
35 let node01 = stretch
36 .new_node(
37 stretch::style::Style {
38 flex_direction: stretch::style::FlexDirection::Column,
39 margin: stretch::geometry::Rect { end: stretch::style::Dimension::Points(10f32), ..Default::default() },
40 ..Default::default()
41 },
42 &[node010],
43 )
44 .unwrap();
45 let node0 = stretch
46 .new_node(
47 stretch::style::Style {
48 flex_wrap: stretch::style::FlexWrap::Wrap,
49 size: stretch::geometry::Size { width: stretch::style::Dimension::Points(85f32), ..Default::default() },
50 ..Default::default()
51 },
52 &[node00, node01],
53 )
54 .unwrap();
55 let node = stretch
56 .new_node(
57 stretch::style::Style {
58 flex_direction: stretch::style::FlexDirection::Column,
59 size: stretch::geometry::Size {
60 width: stretch::style::Dimension::Points(500f32),
61 height: stretch::style::Dimension::Points(500f32),
62 ..Default::default()
63 },
64 ..Default::default()
65 },
66 &[node0],
67 )
68 .unwrap();
69 stretch.compute_layout(node, stretch::geometry::Size::undefined()).unwrap();
70}