gioser

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 1111HTML 1039Markdown 12TOML 94541 Definiciones

⎇ 0.2.x benches/generated/gap_row_gap_align_items_end.rs Rust · 78 líneas · 2.7 KB Historia Quién tocó qué crudo

Rename FlexboxLayout back to Style (#251) 49893a7d9 · Nico Burns ·

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