tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 707HTML 660Markdown 12TOML 62344 Definitions

⎇ a380b58cb0418ea3728af9a67d188410c6c10f7a benches/generated/margin_top.rs Rust · 31 lines · 1.1 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 {
7                    height: stretch::style::Dimension::Points(10f32),
8                    ..Default::default()
9                },
10                margin: stretch::geometry::Rect { top: stretch::style::Dimension::Points(10f32), ..Default::default() },
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                size: stretch::geometry::Size {
21                    width: stretch::style::Dimension::Points(100f32),
22                    height: stretch::style::Dimension::Points(100f32),
23                    ..Default::default()
24                },
25                ..Default::default()
26            },
27            &[node0],
28        )
29        .unwrap();
30    stretch.compute_layout(node, stretch::geometry::Size::undefined()).unwrap();
31}