gioser

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 499HTML 254C 19JavaScript 81371 Definiciones

⎇ 72a1d81325e63c351a9bcbf07427e676cbe938c4 benches/generated/flex_grow_within_max_width.rs Rust · 43 líneas · 1.4 KB Historia Quién tocó qué crudo

rename stretch to stretch2 79aa44fa4 · elbaro ·

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