tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

HTML 231Rust 9TOML 3CSS 1345 Sutichaykuna

⎇ a380b58cb0418ea3728af9a67d188410c6c10f7a benches/generated/margin_auto_bottom.rs Rust · 45 siq'ikuna · 1.6 KB Ñawpa willay Pi imata llamkarqan ch'uya

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