tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 1085HTML 1017Markdown 12TOML 83230 Definiciones

⎇ 0.2.x benches/generated/flex_wrap_align_stretch_fits_one_row.rs Rust · 36 líneas · 1.2 KB Historia Quién tocó qué crudo

Rename FlexboxLayout back to Style (#251) 49893a7d9 · Nico Burns ·

1pub fn compute() {
2    let mut taffy = taffy::Taffy::new();
3    let node0 = taffy
4        .new_with_children(
5            taffy::style::Style {
6                size: taffy::geometry::Size { width: taffy::style::Dimension::Points(50f32), ..Default::default() },
7                ..Default::default()
8            },
9            &[],
10        )
11        .unwrap();
12    let node1 = taffy
13        .new_with_children(
14            taffy::style::Style {
15                size: taffy::geometry::Size { width: taffy::style::Dimension::Points(50f32), ..Default::default() },
16                ..Default::default()
17            },
18            &[],
19        )
20        .unwrap();
21    let node = taffy
22        .new_with_children(
23            taffy::style::Style {
24                flex_wrap: taffy::style::FlexWrap::Wrap,
25                size: taffy::geometry::Size {
26                    width: taffy::style::Dimension::Points(150f32),
27                    height: taffy::style::Dimension::Points(100f32),
28                    ..Default::default()
29                },
30                ..Default::default()
31            },
32            &[node0, node1],
33        )
34        .unwrap();
35    taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
36}