tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 707HTML 660Markdown 12TOML 62344 Definitions

⎇ d67e82255da07928c7e415ea7364529d204bbaf9 benches/generated/margin_should_not_be_part_of_max_height.rs Rust · 38 lines · 1.3 KB History Who touched what raw

Fix formatting d67e82255 · elbaro ·

1pub fn compute() {
2    let mut stretch = stretch2::Stretch::new();
3    let node0 = stretch
4        .new_node(
5            stretch2::style::Style {
6                size: stretch2::geometry::Size {
7                    width: stretch2::style::Dimension::Points(100f32),
8                    height: stretch2::style::Dimension::Points(100f32),
9                    ..Default::default()
10                },
11                max_size: stretch2::geometry::Size {
12                    height: stretch2::style::Dimension::Points(100f32),
13                    ..Default::default()
14                },
15                margin: stretch2::geometry::Rect {
16                    top: stretch2::style::Dimension::Points(20f32),
17                    ..Default::default()
18                },
19                ..Default::default()
20            },
21            &[],
22        )
23        .unwrap();
24    let node = stretch
25        .new_node(
26            stretch2::style::Style {
27                size: stretch2::geometry::Size {
28                    width: stretch2::style::Dimension::Points(250f32),
29                    height: stretch2::style::Dimension::Points(250f32),
30                    ..Default::default()
31                },
32                ..Default::default()
33            },
34            &[node0],
35        )
36        .unwrap();
37    stretch.compute_layout(node, stretch2::geometry::Size::undefined()).unwrap();
38}