gioser

tawasuyu/taffy

A high performance rust-powered UI layout library

HTML 5334Rust 85Markdown 12TOML 91813 Definitions

⎇ d8c8bb472833ba92d694a9420e4c5bd8308e32e3 benches/generated/wrap_reverse_row_align_content_flex_start.rs Rust · 82 lines · 2.7 KB History Who touched what raw

Strict types for style values (#269) 0d8c198a9 · Nico Burns ·

1pub fn compute() {
2    #[allow(unused_imports)]
3    use taffy::prelude::*;
4    let mut taffy = taffy::Taffy::new();
5    let node0 = taffy
6        .new_with_children(
7            taffy::style::Style {
8                size: taffy::geometry::Size {
9                    width: taffy::style::Dimension::Points(30f32),
10                    height: taffy::style::Dimension::Points(10f32),
11                    ..Size::auto()
12                },
13                ..Default::default()
14            },
15            &[],
16        )
17        .unwrap();
18    let node1 = taffy
19        .new_with_children(
20            taffy::style::Style {
21                size: taffy::geometry::Size {
22                    width: taffy::style::Dimension::Points(30f32),
23                    height: taffy::style::Dimension::Points(20f32),
24                    ..Size::auto()
25                },
26                ..Default::default()
27            },
28            &[],
29        )
30        .unwrap();
31    let node2 = taffy
32        .new_with_children(
33            taffy::style::Style {
34                size: taffy::geometry::Size {
35                    width: taffy::style::Dimension::Points(30f32),
36                    height: taffy::style::Dimension::Points(30f32),
37                    ..Size::auto()
38                },
39                ..Default::default()
40            },
41            &[],
42        )
43        .unwrap();
44    let node3 = taffy
45        .new_with_children(
46            taffy::style::Style {
47                size: taffy::geometry::Size {
48                    width: taffy::style::Dimension::Points(30f32),
49                    height: taffy::style::Dimension::Points(40f32),
50                    ..Size::auto()
51                },
52                ..Default::default()
53            },
54            &[],
55        )
56        .unwrap();
57    let node4 = taffy
58        .new_with_children(
59            taffy::style::Style {
60                size: taffy::geometry::Size {
61                    width: taffy::style::Dimension::Points(30f32),
62                    height: taffy::style::Dimension::Points(50f32),
63                    ..Size::auto()
64                },
65                ..Default::default()
66            },
67            &[],
68        )
69        .unwrap();
70    let node = taffy
71        .new_with_children(
72            taffy::style::Style {
73                flex_wrap: taffy::style::FlexWrap::WrapReverse,
74                align_content: taffy::style::AlignContent::FlexStart,
75                size: taffy::geometry::Size { width: taffy::style::Dimension::Points(100f32), ..Size::auto() },
76                ..Default::default()
77            },
78            &[node0, node1, node2, node3, node4],
79        )
80        .unwrap();
81    taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
82}