tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

HTML 231Rust 9TOML 3CSS 1345 Sutichaykuna

⎇ ec371711989b7f4d870d91bea4b66bdd94b45c9e benches/generated/align_content_stretch_row_with_fixed_height.rs Rust · 53 siq'ikuna · 1.9 KB Ñawpa willay Pi imata llamkarqan ch'uya

Import yoga tests (#320) e05b9093d · 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 { width: taffy::style::Dimension::Points(50f32), height: auto() },
8            ..Default::default()
9        })
10        .unwrap();
11    let node1 = taffy
12        .new_leaf(taffy::style::Style {
13            size: taffy::geometry::Size {
14                width: taffy::style::Dimension::Points(50f32),
15                height: taffy::style::Dimension::Points(60f32),
16            },
17            ..Default::default()
18        })
19        .unwrap();
20    let node2 = taffy
21        .new_leaf(taffy::style::Style {
22            size: taffy::geometry::Size { width: taffy::style::Dimension::Points(50f32), height: auto() },
23            ..Default::default()
24        })
25        .unwrap();
26    let node3 = taffy
27        .new_leaf(taffy::style::Style {
28            size: taffy::geometry::Size { width: taffy::style::Dimension::Points(50f32), height: auto() },
29            ..Default::default()
30        })
31        .unwrap();
32    let node4 = taffy
33        .new_leaf(taffy::style::Style {
34            size: taffy::geometry::Size { width: taffy::style::Dimension::Points(50f32), height: auto() },
35            ..Default::default()
36        })
37        .unwrap();
38    let node = taffy
39        .new_with_children(
40            taffy::style::Style {
41                flex_wrap: taffy::style::FlexWrap::Wrap,
42                align_content: Some(taffy::style::AlignContent::Stretch),
43                size: taffy::geometry::Size {
44                    width: taffy::style::Dimension::Points(150f32),
45                    height: taffy::style::Dimension::Points(100f32),
46                },
47                ..Default::default()
48            },
49            &[node0, node1, node2, node3, node4],
50        )
51        .unwrap();
52    taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
53}