tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 501HTML 254C 19JavaScript 81414 Sutichaykuna

⎇ 0.2.x benches/generated/min_height.rs Rust · 32 siq'ikuna · 1.1 KB Ñawpa willay Pi imata llamkarqan ch'uya

Rename FlexboxLayout back to Style (#251) 49893a7d9 · Nico Burns ·

1pub fn compute() {
2    let mut taffy = taffy::Taffy::new();
3    let node0 = taffy
4        .new_with_children(
5            taffy::style::Style {
6                flex_grow: 1f32,
7                min_size: taffy::geometry::Size {
8                    height: taffy::style::Dimension::Points(60f32),
9                    ..Default::default()
10                },
11                ..Default::default()
12            },
13            &[],
14        )
15        .unwrap();
16    let node1 = taffy.new_with_children(taffy::style::Style { flex_grow: 1f32, ..Default::default() }, &[]).unwrap();
17    let node = taffy
18        .new_with_children(
19            taffy::style::Style {
20                flex_direction: taffy::style::FlexDirection::Column,
21                size: taffy::geometry::Size {
22                    width: taffy::style::Dimension::Points(100f32),
23                    height: taffy::style::Dimension::Points(100f32),
24                    ..Default::default()
25                },
26                ..Default::default()
27            },
28            &[node0, node1],
29        )
30        .unwrap();
31    taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
32}