tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 707HTML 660Markdown 12TOML 62344 Definiciones

⎇ a380b58cb0418ea3728af9a67d188410c6c10f7a benches/generated/rounding_fractial_input_3.rs Rust · 58 líneas · 1.9 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
4        .new_node(
5            stretch::style::Style {
6                flex_grow: 1f32,
7                flex_basis: stretch::style::Dimension::Points(50f32),
8                size: stretch::geometry::Size {
9                    height: stretch::style::Dimension::Points(20f32),
10                    ..Default::default()
11                },
12                ..Default::default()
13            },
14            &[],
15        )
16        .unwrap();
17    let node1 = stretch
18        .new_node(
19            stretch::style::Style {
20                flex_grow: 1f32,
21                size: stretch::geometry::Size {
22                    height: stretch::style::Dimension::Points(10f32),
23                    ..Default::default()
24                },
25                ..Default::default()
26            },
27            &[],
28        )
29        .unwrap();
30    let node2 = stretch
31        .new_node(
32            stretch::style::Style {
33                flex_grow: 1f32,
34                size: stretch::geometry::Size {
35                    height: stretch::style::Dimension::Points(10f32),
36                    ..Default::default()
37                },
38                ..Default::default()
39            },
40            &[],
41        )
42        .unwrap();
43    let node = stretch
44        .new_node(
45            stretch::style::Style {
46                flex_direction: stretch::style::FlexDirection::Column,
47                size: stretch::geometry::Size {
48                    width: stretch::style::Dimension::Points(100f32),
49                    height: stretch::style::Dimension::Points(113.4f32),
50                    ..Default::default()
51                },
52                ..Default::default()
53            },
54            &[node0, node1, node2],
55        )
56        .unwrap();
57    stretch.compute_layout(node, stretch::geometry::Size::undefined()).unwrap();
58}