tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

HTML 231Rust 9TOML 3CSS 1345 Definitions

⎇ ec371711989b7f4d870d91bea4b66bdd94b45c9e benches/generated/undefined_width_with_min_max_row.rs Rust · 34 lines · 1.2 KB History Who touched what raw

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            size: taffy::geometry::Size {
8                width: taffy::style::Dimension::Points(30f32),
9                height: taffy::style::Dimension::Points(20f32),
10            },
11            ..Default::default()
12        })
13        .unwrap();
14    let node0 = taffy
15        .new_with_children(
16            taffy::style::Style {
17                min_size: taffy::geometry::Size { width: taffy::style::Dimension::Points(60f32), height: auto() },
18                max_size: taffy::geometry::Size { width: taffy::style::Dimension::Points(300f32), height: auto() },
19                ..Default::default()
20            },
21            &[node00],
22        )
23        .unwrap();
24    let node = taffy
25        .new_with_children(
26            taffy::style::Style {
27                size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Points(50f32) },
28                ..Default::default()
29            },
30            &[node0],
31        )
32        .unwrap();
33    taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
34}