gioser

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 499HTML 254C 19JavaScript 81371 Definiciones

⎇ b91874d4e34ecc9054b468a338ffcae6f61a1b4a benches/generated/rounding_inner_node_controversy_vertical.rs Rust · 48 líneas · 1.7 KB Historia Quién tocó qué crudo

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            flex_grow: 1f32,
8            size: taffy::geometry::Size { width: taffy::style::Dimension::Points(10f32), height: auto() },
9            ..Default::default()
10        })
11        .unwrap();
12    let node10 = taffy
13        .new_leaf(taffy::style::Style {
14            flex_grow: 1f32,
15            size: taffy::geometry::Size { width: taffy::style::Dimension::Points(10f32), height: auto() },
16            ..Default::default()
17        })
18        .unwrap();
19    let node1 = taffy
20        .new_with_children(
21            taffy::style::Style {
22                flex_direction: taffy::style::FlexDirection::Column,
23                flex_grow: 1f32,
24                size: taffy::geometry::Size { width: taffy::style::Dimension::Points(10f32), height: auto() },
25                ..Default::default()
26            },
27            &[node10],
28        )
29        .unwrap();
30    let node2 = taffy
31        .new_leaf(taffy::style::Style {
32            flex_grow: 1f32,
33            size: taffy::geometry::Size { width: taffy::style::Dimension::Points(10f32), height: auto() },
34            ..Default::default()
35        })
36        .unwrap();
37    let node = taffy
38        .new_with_children(
39            taffy::style::Style {
40                flex_direction: taffy::style::FlexDirection::Column,
41                size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Points(320f32) },
42                ..Default::default()
43            },
44            &[node0, node1, node2],
45        )
46        .unwrap();
47    taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
48}