tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 583HTML 275Markdown 8TOML 41586 Definitions

⎇ 95934288c2c358836f303a7595ecd9fbe3efbd62 benches/generated/wrap_reverse_column.rs Rust · 71 lines · 2.4 KB History Who touched what raw

Rename `new_node` to `new_with_children` (#142) 5d00d8fb9 · Andreas Weibye ·

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