tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

⎇ bf3dfaec9e387a7e67408fc78ca869d7eaaa8e1f benches/generated/align_baseline_child_multiline.rs Rust · 71 líneas · 2.4 KB Historia Quién tocó qué crudo

Implement CSS Grid (#205) 6fd2c6bcb · 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_leaf(taffy::style::Style {
7            size: taffy::geometry::Size {
8                width: taffy::style::Dimension::Points(50f32),
9                height: taffy::style::Dimension::Points(60f32),
10            },
11            ..Default::default()
12        })
13        .unwrap();
14    let node10 = taffy
15        .new_leaf(taffy::style::Style {
16            size: taffy::geometry::Size {
17                width: taffy::style::Dimension::Points(25f32),
18                height: taffy::style::Dimension::Points(20f32),
19            },
20            ..Default::default()
21        })
22        .unwrap();
23    let node11 = taffy
24        .new_leaf(taffy::style::Style {
25            size: taffy::geometry::Size {
26                width: taffy::style::Dimension::Points(25f32),
27                height: taffy::style::Dimension::Points(10f32),
28            },
29            ..Default::default()
30        })
31        .unwrap();
32    let node12 = taffy
33        .new_leaf(taffy::style::Style {
34            size: taffy::geometry::Size {
35                width: taffy::style::Dimension::Points(25f32),
36                height: taffy::style::Dimension::Points(20f32),
37            },
38            ..Default::default()
39        })
40        .unwrap();
41    let node13 = taffy
42        .new_leaf(taffy::style::Style {
43            size: taffy::geometry::Size {
44                width: taffy::style::Dimension::Points(25f32),
45                height: taffy::style::Dimension::Points(10f32),
46            },
47            ..Default::default()
48        })
49        .unwrap();
50    let node1 = taffy
51        .new_with_children(
52            taffy::style::Style {
53                flex_wrap: taffy::style::FlexWrap::Wrap,
54                size: taffy::geometry::Size { width: taffy::style::Dimension::Points(50f32), height: auto() },
55                ..Default::default()
56            },
57            &[node10, node11, node12, node13],
58        )
59        .unwrap();
60    let node = taffy
61        .new_with_children(
62            taffy::style::Style {
63                align_items: Some(taffy::style::AlignItems::Baseline),
64                size: taffy::geometry::Size { width: taffy::style::Dimension::Points(100f32), height: auto() },
65                ..Default::default()
66            },
67            &[node0, node1],
68        )
69        .unwrap();
70    taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
71}