tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 501HTML 254C 19JavaScript 81414 Definitions

⎇ 0.1.x benches/generated/wrap_row.rs Rust · 66 lines · 2.1 KB History Who touched what raw

Rename sprawl to taffy (#134) 8936790d6 · Alice Cecile ·

1pub fn compute() {
2    let mut taffy = taffy::Taffy::new();
3    let node0 = taffy
4        .new_node(
5            taffy::style::Style {
6                size: taffy::geometry::Size {
7                    width: taffy::style::Dimension::Points(31f32),
8                    height: taffy::style::Dimension::Points(30f32),
9                    ..Default::default()
10                },
11                ..Default::default()
12            },
13            &[],
14        )
15        .unwrap();
16    let node1 = taffy
17        .new_node(
18            taffy::style::Style {
19                size: taffy::geometry::Size {
20                    width: taffy::style::Dimension::Points(32f32),
21                    height: taffy::style::Dimension::Points(30f32),
22                    ..Default::default()
23                },
24                ..Default::default()
25            },
26            &[],
27        )
28        .unwrap();
29    let node2 = taffy
30        .new_node(
31            taffy::style::Style {
32                size: taffy::geometry::Size {
33                    width: taffy::style::Dimension::Points(33f32),
34                    height: taffy::style::Dimension::Points(30f32),
35                    ..Default::default()
36                },
37                ..Default::default()
38            },
39            &[],
40        )
41        .unwrap();
42    let node3 = taffy
43        .new_node(
44            taffy::style::Style {
45                size: taffy::geometry::Size {
46                    width: taffy::style::Dimension::Points(34f32),
47                    height: taffy::style::Dimension::Points(30f32),
48                    ..Default::default()
49                },
50                ..Default::default()
51            },
52            &[],
53        )
54        .unwrap();
55    let node = taffy
56        .new_node(
57            taffy::style::Style {
58                flex_wrap: taffy::style::FlexWrap::Wrap,
59                size: taffy::geometry::Size { width: taffy::style::Dimension::Points(100f32), ..Default::default() },
60                ..Default::default()
61            },
62            &[node0, node1, node2, node3],
63        )
64        .unwrap();
65    taffy.compute_layout(node, taffy::geometry::Size::undefined()).unwrap();
66}