gioser

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 501HTML 254C 19JavaScript 81414 Definitions

⎇ 6973276025fedf5dbe9a65fe9a4e300254add410 benches/generated/justify_content_row_max_width_and_margin.rs Rust · 38 lines · 1.3 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(20f32),
8                    height: stretch::style::Dimension::Points(20f32),
9                    ..Default::default()
10                },
11                margin: stretch::geometry::Rect {
12                    start: stretch::style::Dimension::Points(100f32),
13                    ..Default::default()
14                },
15                ..Default::default()
16            },
17            vec![],
18        )
19        .unwrap();
20    let node = stretch
21        .new_node(
22            stretch::style::Style {
23                justify_content: stretch::style::JustifyContent::Center,
24                size: stretch::geometry::Size {
25                    width: stretch::style::Dimension::Points(100f32),
26                    ..Default::default()
27                },
28                max_size: stretch::geometry::Size {
29                    width: stretch::style::Dimension::Points(80f32),
30                    ..Default::default()
31                },
32                ..Default::default()
33            },
34            vec![node0],
35        )
36        .unwrap();
37    stretch.compute_layout(node, stretch::geometry::Size::undefined()).unwrap();
38}