tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 583HTML 275Markdown 8TOML 41586 Definitions

⎇ ec371711989b7f4d870d91bea4b66bdd94b45c9e benches/generated/undefined_width_with_min_max.rs Rust · 23 lines · 908 B 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 node0 = taffy
6        .new_leaf(taffy::style::Style {
7            min_size: taffy::geometry::Size { width: taffy::style::Dimension::Points(0f32), height: auto() },
8            max_size: taffy::geometry::Size { width: taffy::style::Dimension::Points(100f32), height: auto() },
9            ..Default::default()
10        })
11        .unwrap();
12    let node = taffy
13        .new_with_children(
14            taffy::style::Style {
15                flex_direction: taffy::style::FlexDirection::Column,
16                size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Points(50f32) },
17                ..Default::default()
18            },
19            &[node0],
20        )
21        .unwrap();
22    taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
23}