tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

HTML 231Rust 8TOML 3CSS 1317 Sutichaykuna

⎇ d67e82255da07928c7e415ea7364529d204bbaf9 benches/generated/wrap_nodes_with_content_sizing_overflowing_margin.rs Rust · 76 siq'ikuna · 2.5 KB Ñawpa willay Pi imata llamkarqan ch'uya

Fix formatting d67e82255 · elbaro ·

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