tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 707HTML 660Markdown 12TOML 62344 Definitions

⎇ b91874d4e34ecc9054b468a338ffcae6f61a1b4a benches/generated/align_self_center_undefined_max_height.rs Rust · 35 lines · 1.3 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 node0 = taffy
6        .new_leaf(taffy::style::Style {
7            size: taffy::geometry::Size {
8                width: taffy::style::Dimension::Points(240f32),
9                height: taffy::style::Dimension::Points(44f32),
10            },
11            ..Default::default()
12        })
13        .unwrap();
14    let node1 = taffy
15        .new_leaf(taffy::style::Style {
16            align_self: Some(taffy::style::AlignSelf::Center),
17            size: taffy::geometry::Size {
18                width: taffy::style::Dimension::Points(40f32),
19                height: taffy::style::Dimension::Points(56f32),
20            },
21            ..Default::default()
22        })
23        .unwrap();
24    let node = taffy
25        .new_with_children(
26            taffy::style::Style {
27                size: taffy::geometry::Size { width: taffy::style::Dimension::Points(280f32), height: auto() },
28                min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Points(52f32) },
29                ..Default::default()
30            },
31            &[node0, node1],
32        )
33        .unwrap();
34    taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
35}