tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 583HTML 275Markdown 8TOML 41586 Sutichaykuna

⎇ 0.1.x benches/generated/flex_shrink_flex_grow_row.rs Rust · 47 siq'ikuna · 1.5 KB Ñawpa willay Pi imata llamkarqan ch'uya

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

1pub fn compute() {
2    let mut taffy = taffy::Taffy::new();
3    let node0 = taffy
4        .new_node(
5            taffy::style::Style {
6                flex_grow: 0f32,
7                flex_shrink: 1f32,
8                size: taffy::geometry::Size {
9                    width: taffy::style::Dimension::Points(500f32),
10                    height: taffy::style::Dimension::Points(100f32),
11                    ..Default::default()
12                },
13                ..Default::default()
14            },
15            &[],
16        )
17        .unwrap();
18    let node1 = taffy
19        .new_node(
20            taffy::style::Style {
21                flex_grow: 0f32,
22                flex_shrink: 1f32,
23                size: taffy::geometry::Size {
24                    width: taffy::style::Dimension::Points(500f32),
25                    height: taffy::style::Dimension::Points(100f32),
26                    ..Default::default()
27                },
28                ..Default::default()
29            },
30            &[],
31        )
32        .unwrap();
33    let node = taffy
34        .new_node(
35            taffy::style::Style {
36                size: taffy::geometry::Size {
37                    width: taffy::style::Dimension::Points(500f32),
38                    height: taffy::style::Dimension::Points(500f32),
39                    ..Default::default()
40                },
41                ..Default::default()
42            },
43            &[node0, node1],
44        )
45        .unwrap();
46    taffy.compute_layout(node, taffy::geometry::Size::undefined()).unwrap();
47}