gioser

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 709HTML 662Markdown 12TOML 62348 Sutichaykuna

⎇ 0.2.x benches/generated/wrapped_row_within_align_items_flex_end.rs Rust · 51 siq'ikuna · 1.7 KB Ñawpa willay Pi imata llamkarqan ch'uya

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

1pub fn compute() {
2    let mut taffy = taffy::Taffy::new();
3    let node00 = taffy
4        .new_with_children(
5            taffy::style::Style {
6                size: taffy::geometry::Size {
7                    width: taffy::style::Dimension::Points(150f32),
8                    height: taffy::style::Dimension::Points(80f32),
9                    ..Default::default()
10                },
11                ..Default::default()
12            },
13            &[],
14        )
15        .unwrap();
16    let node01 = taffy
17        .new_with_children(
18            taffy::style::Style {
19                size: taffy::geometry::Size {
20                    width: taffy::style::Dimension::Points(80f32),
21                    height: taffy::style::Dimension::Points(80f32),
22                    ..Default::default()
23                },
24                ..Default::default()
25            },
26            &[],
27        )
28        .unwrap();
29    let node0 = taffy
30        .new_with_children(
31            taffy::style::Style { flex_wrap: taffy::style::FlexWrap::Wrap, ..Default::default() },
32            &[node00, node01],
33        )
34        .unwrap();
35    let node = taffy
36        .new_with_children(
37            taffy::style::Style {
38                flex_direction: taffy::style::FlexDirection::Column,
39                align_items: taffy::style::AlignItems::FlexEnd,
40                size: taffy::geometry::Size {
41                    width: taffy::style::Dimension::Points(200f32),
42                    height: taffy::style::Dimension::Points(200f32),
43                    ..Default::default()
44                },
45                ..Default::default()
46            },
47            &[node0],
48        )
49        .unwrap();
50    taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
51}