tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

HTML 231Rust 9TOML 3CSS 1345 Definitions

⎇ edd994fd39750e366114cf4d5a66f7092a97edfa benches/generated/wrap_nodes_with_content_sizing_overflowing_margin.rs Rust · 70 lines · 2.4 KB History Who touched what raw

Update benches to API changes edd994fd3 · msiglreith ·

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            vec![],
14        )
15        .unwrap();
16    let node00 = stretch
17        .new_node(
18            stretch::style::Style { flex_direction: stretch::style::FlexDirection::Column, ..Default::default() },
19            vec![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            vec![],
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            vec![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            vec![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            vec![node0],
67        )
68        .unwrap();
69    stretch.compute_layout(node, stretch::geometry::Size::undefined()).unwrap();
70}