tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

HTML 231Rust 9TOML 3CSS 1345 Definitions

⎇ 0.1.x benches/generated/flex_wrap_wrap_to_child_height.rs Rust · 56 lines · 1.8 KB History Who touched what raw

Rename sprawl to taffy (#134) 8936790d6 · Alice Cecile ·

1pub fn compute() {
2    let mut taffy = taffy::Taffy::new();
3    let node000 = taffy
4        .new_node(
5            taffy::style::Style {
6                size: taffy::geometry::Size {
7                    width: taffy::style::Dimension::Points(100f32),
8                    height: taffy::style::Dimension::Points(100f32),
9                    ..Default::default()
10                },
11                ..Default::default()
12            },
13            &[],
14        )
15        .unwrap();
16    let node00 = taffy
17        .new_node(
18            taffy::style::Style {
19                flex_direction: taffy::style::FlexDirection::Column,
20                size: taffy::geometry::Size { width: taffy::style::Dimension::Points(100f32), ..Default::default() },
21                ..Default::default()
22            },
23            &[node000],
24        )
25        .unwrap();
26    let node0 = taffy
27        .new_node(
28            taffy::style::Style {
29                flex_wrap: taffy::style::FlexWrap::Wrap,
30                align_items: taffy::style::AlignItems::FlexStart,
31                ..Default::default()
32            },
33            &[node00],
34        )
35        .unwrap();
36    let node1 = taffy
37        .new_node(
38            taffy::style::Style {
39                size: taffy::geometry::Size {
40                    width: taffy::style::Dimension::Points(100f32),
41                    height: taffy::style::Dimension::Points(100f32),
42                    ..Default::default()
43                },
44                ..Default::default()
45            },
46            &[],
47        )
48        .unwrap();
49    let node = taffy
50        .new_node(
51            taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, ..Default::default() },
52            &[node0, node1],
53        )
54        .unwrap();
55    taffy.compute_layout(node, taffy::geometry::Size::undefined()).unwrap();
56}