tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 707HTML 660Markdown 12TOML 62344 Definiciones

⎇ a380b58cb0418ea3728af9a67d188410c6c10f7a benches/generated/flex_grow_within_constrained_min_column.rs Rust · 30 líneas · 1.0 KB Historia Quién tocó qué crudo

Update all benchmarks to use the new API a380b58cb · David Flemström ·

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