gioser

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 707HTML 660Markdown 12TOML 62344 Definitions

⎇ 72a1d81325e63c351a9bcbf07427e676cbe938c4 benches/generated/min_width.rs Rust · 31 lines · 1.1 KB History Who touched what raw

rename stretch to stretch2 79aa44fa4 · elbaro ·

1pub fn compute() {
2    let mut stretch = stretch2::Stretch::new();
3    let node0 = stretch
4        .new_node(
5            stretch2::style::Style {
6                flex_grow: 1f32,
7                min_size: stretch2::geometry::Size {
8                    width: stretch2::style::Dimension::Points(60f32),
9                    ..Default::default()
10                },
11                ..Default::default()
12            },
13            &[],
14        )
15        .unwrap();
16    let node1 = stretch.new_node(stretch2::style::Style { flex_grow: 1f32, ..Default::default() }, &[]).unwrap();
17    let node = stretch
18        .new_node(
19            stretch2::style::Style {
20                size: stretch2::geometry::Size {
21                    width: stretch2::style::Dimension::Points(100f32),
22                    height: stretch2::style::Dimension::Points(100f32),
23                    ..Default::default()
24                },
25                ..Default::default()
26            },
27            &[node0, node1],
28        )
29        .unwrap();
30    stretch.compute_layout(node, stretch2::geometry::Size::undefined()).unwrap();
31}