gioser

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 501HTML 254C 19JavaScript 81414 Definiciones

⎇ d8c8bb472833ba92d694a9420e4c5bd8308e32e3 benches/generated/gap_column_gap_wrap_align_flex_end.rs Rust · 104 líneas · 3.4 KB Historia Quién tocó qué crudo

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(20f32),
10                    height: taffy::style::Dimension::Points(20f32),
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(20f32),
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(20f32),
36                    height: taffy::style::Dimension::Points(20f32),
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(20f32),
49                    height: taffy::style::Dimension::Points(20f32),
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(20f32),
62                    height: taffy::style::Dimension::Points(20f32),
63                    ..Size::auto()
64                },
65                ..Default::default()
66            },
67            &[],
68        )
69        .unwrap();
70    let node5 = taffy
71        .new_with_children(
72            taffy::style::Style {
73                size: taffy::geometry::Size {
74                    width: taffy::style::Dimension::Points(20f32),
75                    height: taffy::style::Dimension::Points(20f32),
76                    ..Size::auto()
77                },
78                ..Default::default()
79            },
80            &[],
81        )
82        .unwrap();
83    let node = taffy
84        .new_with_children(
85            taffy::style::Style {
86                flex_wrap: taffy::style::FlexWrap::Wrap,
87                align_content: taffy::style::AlignContent::FlexEnd,
88                gap: taffy::geometry::Size {
89                    width: taffy::style::LengthPercentage::Points(10f32),
90                    height: taffy::style::LengthPercentage::Points(20f32),
91                    ..Size::zero()
92                },
93                size: taffy::geometry::Size {
94                    width: taffy::style::Dimension::Points(100f32),
95                    height: taffy::style::Dimension::Points(100f32),
96                    ..Size::auto()
97                },
98                ..Default::default()
99            },
100            &[node0, node1, node2, node3, node4, node5],
101        )
102        .unwrap();
103    taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
104}