tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

HTML 231Rust 9TOML 3CSS 1345 Definitions

⎇ edd994fd39750e366114cf4d5a66f7092a97edfa benches/generated/size_defined_by_child_with_padding.rs Rust · 32 lines · 1.1 KB History Who touched what raw

Update benches to API changes edd994fd3 · msiglreith ·

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(10f32),
8                    height: stretch::style::Dimension::Points(10f32),
9                    ..Default::default()
10                },
11                ..Default::default()
12            },
13            vec![],
14        )
15        .unwrap();
16    let node = stretch
17        .new_node(
18            stretch::style::Style {
19                padding: stretch::geometry::Rect {
20                    start: stretch::style::Dimension::Points(10f32),
21                    end: stretch::style::Dimension::Points(10f32),
22                    top: stretch::style::Dimension::Points(10f32),
23                    bottom: stretch::style::Dimension::Points(10f32),
24                    ..Default::default()
25                },
26                ..Default::default()
27            },
28            vec![node0],
29        )
30        .unwrap();
31    stretch.compute_layout(node, stretch::geometry::Size::undefined()).unwrap();
32}