gioser

tawasuyu/taffy

A high performance rust-powered UI layout library

HTML 5464Rust 87Markdown 12TOML 91903 Definiciones

⎇ 9f42ca4a0d99e501f16c3148bd1caf12b37b2ac5 benches/generated/flex_grow_within_constrained_max_row.rs Rust · 52 líneas · 1.7 KB Historia Quién tocó qué crudo

Update benches to API changes 9f42ca4a0 · msiglreith ·

1pub fn compute() {
2    let mut stretch = stretch::Stretch::new();
3    let node00 = stretch
4        .new_node(
5            stretch::style::Style {
6                flex_shrink: 1f32,
7                flex_basis: stretch::style::Dimension::Points(100f32),
8                ..Default::default()
9            },
10            vec![],
11        )
12        .unwrap();
13    let node01 = stretch
14        .new_node(
15            stretch::style::Style {
16                size: stretch::geometry::Size { width: stretch::style::Dimension::Points(50f32), ..Default::default() },
17                ..Default::default()
18            },
19            vec![],
20        )
21        .unwrap();
22    let node0 = stretch
23        .new_node(
24            stretch::style::Style {
25                size: stretch::geometry::Size {
26                    height: stretch::style::Dimension::Points(100f32),
27                    ..Default::default()
28                },
29                max_size: stretch::geometry::Size {
30                    width: stretch::style::Dimension::Points(100f32),
31                    ..Default::default()
32                },
33                ..Default::default()
34            },
35            vec![node00, node01],
36        )
37        .unwrap();
38    let node = stretch
39        .new_node(
40            stretch::style::Style {
41                flex_direction: stretch::style::FlexDirection::Column,
42                size: stretch::geometry::Size {
43                    width: stretch::style::Dimension::Points(200f32),
44                    ..Default::default()
45                },
46                ..Default::default()
47            },
48            vec![node0],
49        )
50        .unwrap();
51    stretch.compute_layout(node, stretch::geometry::Size::undefined()).unwrap();
52}