tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 707HTML 660Markdown 12TOML 62344 Definitions

⎇ ec371711989b7f4d870d91bea4b66bdd94b45c9e benches/generated/align_content_not_stretch_with_align_items_stretch.rs Rust · 50 lines · 1.7 KB History Who touched what raw

Reinstate FlexStart and FlexEnd alignment variants (#336) 78fd9cc09 · Nico Burns ·

1pub fn compute() {
2    #[allow(unused_imports)]
3    use taffy::prelude::*;
4    let mut taffy = taffy::Taffy::new();
5    let node00 = taffy
6        .new_leaf(taffy::style::Style {
7            size: taffy::geometry::Size {
8                width: taffy::style::Dimension::Points(272f32),
9                height: taffy::style::Dimension::Points(44f32),
10            },
11            ..Default::default()
12        })
13        .unwrap();
14    let node0 = taffy
15        .new_with_children(
16            taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, ..Default::default() },
17            &[node00],
18        )
19        .unwrap();
20    let node10 = taffy
21        .new_leaf(taffy::style::Style {
22            size: taffy::geometry::Size {
23                width: taffy::style::Dimension::Points(56f32),
24                height: taffy::style::Dimension::Points(44f32),
25            },
26            ..Default::default()
27        })
28        .unwrap();
29    let node1 = taffy
30        .new_with_children(
31            taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, ..Default::default() },
32            &[node10],
33        )
34        .unwrap();
35    let node = taffy
36        .new_with_children(
37            taffy::style::Style {
38                flex_wrap: taffy::style::FlexWrap::Wrap,
39                align_content: Some(taffy::style::AlignContent::FlexStart),
40                size: taffy::geometry::Size {
41                    width: taffy::style::Dimension::Points(328f32),
42                    height: taffy::style::Dimension::Points(52f32),
43                },
44                ..Default::default()
45            },
46            &[node0, node1],
47        )
48        .unwrap();
49    taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
50}