gioser

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 684HTML 640Markdown 12TOML 62290 Definitions

⎇ 3de41935b1054f945bfaeb40dfc213cd57366b9b benches/generated/flex_grow_within_constrained_max_row.rs Rust · 44 lines · 1.6 KB History Who touched what raw

update tests and benchmarks to use new api 1f8c44154 · Emil Sjölander ·

1pub fn compute() -> stretch::result::Layout {
2    stretch::node::Node::new(
3        stretch::style::Style {
4            flex_direction: stretch::style::FlexDirection::Column,
5            size: stretch::geometry::Size { width: stretch::style::Dimension::Points(200f32), ..Default::default() },
6            ..Default::default()
7        },
8        vec![&stretch::node::Node::new(
9            stretch::style::Style {
10                size: stretch::geometry::Size {
11                    height: stretch::style::Dimension::Points(100f32),
12                    ..Default::default()
13                },
14                max_size: stretch::geometry::Size {
15                    width: stretch::style::Dimension::Points(100f32),
16                    ..Default::default()
17                },
18                ..Default::default()
19            },
20            vec![
21                &stretch::node::Node::new(
22                    stretch::style::Style {
23                        flex_shrink: 1f32,
24                        flex_basis: stretch::style::Dimension::Points(100f32),
25                        ..Default::default()
26                    },
27                    vec![],
28                ),
29                &stretch::node::Node::new(
30                    stretch::style::Style {
31                        size: stretch::geometry::Size {
32                            width: stretch::style::Dimension::Points(50f32),
33                            ..Default::default()
34                        },
35                        ..Default::default()
36                    },
37                    vec![],
38                ),
39            ],
40        )],
41    )
42    .compute_layout(stretch::geometry::Size::undefined())
43    .unwrap()
44}