tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

HTML 227Rust 7TOML 3CSS 1307 Definiciones

⎇ b0c7d824daea2c453850812d532c277f8ac37736 benches/generated/align_content_stretch_column.rs Rust · 66 líneas · 2.4 KB Historia Quién tocó qué crudo

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 node00 = taffy
6        .new_leaf(taffy::style::Style {
7            flex_grow: 1f32,
8            flex_shrink: 1f32,
9            flex_basis: taffy::style::Dimension::Percent(0f32),
10            ..Default::default()
11        })
12        .unwrap();
13    let node0 = taffy
14        .new_with_children(
15            taffy::style::Style {
16                flex_direction: taffy::style::FlexDirection::Column,
17                size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Points(50f32) },
18                ..Default::default()
19            },
20            &[node00],
21        )
22        .unwrap();
23    let node1 = taffy
24        .new_leaf(taffy::style::Style {
25            flex_grow: 1f32,
26            flex_shrink: 1f32,
27            flex_basis: taffy::style::Dimension::Percent(0f32),
28            size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Points(50f32) },
29            ..Default::default()
30        })
31        .unwrap();
32    let node2 = taffy
33        .new_leaf(taffy::style::Style {
34            size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Points(50f32) },
35            ..Default::default()
36        })
37        .unwrap();
38    let node3 = taffy
39        .new_leaf(taffy::style::Style {
40            size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Points(50f32) },
41            ..Default::default()
42        })
43        .unwrap();
44    let node4 = taffy
45        .new_leaf(taffy::style::Style {
46            size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Points(50f32) },
47            ..Default::default()
48        })
49        .unwrap();
50    let node = taffy
51        .new_with_children(
52            taffy::style::Style {
53                flex_direction: taffy::style::FlexDirection::Column,
54                flex_wrap: taffy::style::FlexWrap::Wrap,
55                align_content: Some(taffy::style::AlignContent::Stretch),
56                size: taffy::geometry::Size {
57                    width: taffy::style::Dimension::Points(100f32),
58                    height: taffy::style::Dimension::Points(150f32),
59                },
60                ..Default::default()
61            },
62            &[node0, node1, node2, node3, node4],
63        )
64        .unwrap();
65    taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
66}