tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 707HTML 660Markdown 12TOML 62344 Definitions

⎇ a380b58cb0418ea3728af9a67d188410c6c10f7a benches/generated/justify_content_row_flex_end.rs Rust · 45 lines · 1.5 KB History Who touched what raw

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                size: stretch::geometry::Size { width: stretch::style::Dimension::Points(10f32), ..Default::default() },
7                ..Default::default()
8            },
9            &[],
10        )
11        .unwrap();
12    let node1 = stretch
13        .new_node(
14            stretch::style::Style {
15                size: stretch::geometry::Size { width: stretch::style::Dimension::Points(10f32), ..Default::default() },
16                ..Default::default()
17            },
18            &[],
19        )
20        .unwrap();
21    let node2 = stretch
22        .new_node(
23            stretch::style::Style {
24                size: stretch::geometry::Size { width: stretch::style::Dimension::Points(10f32), ..Default::default() },
25                ..Default::default()
26            },
27            &[],
28        )
29        .unwrap();
30    let node = stretch
31        .new_node(
32            stretch::style::Style {
33                justify_content: stretch::style::JustifyContent::FlexEnd,
34                size: stretch::geometry::Size {
35                    width: stretch::style::Dimension::Points(100f32),
36                    height: stretch::style::Dimension::Points(100f32),
37                    ..Default::default()
38                },
39                ..Default::default()
40            },
41            &[node0, node1, node2],
42        )
43        .unwrap();
44    stretch.compute_layout(node, stretch::geometry::Size::undefined()).unwrap();
45}