tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

HTML 231Rust 9TOML 3CSS 1345 Definiciones

⎇ b91874d4e34ecc9054b468a338ffcae6f61a1b4a benches/generated/only_shrinkable_item_with_flex_basis_zero.rs Rust · 44 líneas · 1.5 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_shrink: 1f32,
8            flex_basis: taffy::style::Dimension::Points(0f32),
9            ..Default::default()
10        })
11        .unwrap();
12    let node1 = taffy
13        .new_leaf(taffy::style::Style {
14            flex_shrink: 0f32,
15            flex_basis: taffy::style::Dimension::Points(93f32),
16            margin: taffy::geometry::Rect {
17                left: zero(),
18                right: zero(),
19                top: zero(),
20                bottom: taffy::style::LengthPercentageAuto::Points(6f32),
21            },
22            ..Default::default()
23        })
24        .unwrap();
25    let node2 = taffy
26        .new_leaf(taffy::style::Style {
27            flex_shrink: 0f32,
28            flex_basis: taffy::style::Dimension::Points(764f32),
29            ..Default::default()
30        })
31        .unwrap();
32    let node = taffy
33        .new_with_children(
34            taffy::style::Style {
35                flex_direction: taffy::style::FlexDirection::Column,
36                size: taffy::geometry::Size { width: taffy::style::Dimension::Points(480f32), height: auto() },
37                max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Points(764f32) },
38                ..Default::default()
39            },
40            &[node0, node1, node2],
41        )
42        .unwrap();
43    taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
44}