tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 501HTML 254C 19JavaScript 81412 Definitions

⎇ a380b58cb0418ea3728af9a67d188410c6c10f7a benches/generated/display_none_fixed_size.rs Rust · 32 lines · 1.2 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.new_node(stretch::style::Style { flex_grow: 1f32, ..Default::default() }, &[]).unwrap();
4    let node1 = stretch
5        .new_node(
6            stretch::style::Style {
7                display: stretch::style::Display::None,
8                size: stretch::geometry::Size {
9                    width: stretch::style::Dimension::Points(20f32),
10                    height: stretch::style::Dimension::Points(20f32),
11                    ..Default::default()
12                },
13                ..Default::default()
14            },
15            &[],
16        )
17        .unwrap();
18    let node = stretch
19        .new_node(
20            stretch::style::Style {
21                size: stretch::geometry::Size {
22                    width: stretch::style::Dimension::Points(100f32),
23                    height: stretch::style::Dimension::Points(100f32),
24                    ..Default::default()
25                },
26                ..Default::default()
27            },
28            &[node0, node1],
29        )
30        .unwrap();
31    stretch.compute_layout(node, stretch::geometry::Size::undefined()).unwrap();
32}