gioser

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 496HTML 245JavaScript 8CSS 61214 Definiciones

⎇ d8c8bb472833ba92d694a9420e4c5bd8308e32e3 benches/generated/wrap_row_align_items_flex_end.rs Rust · 69 líneas · 2.2 KB Historia Quién tocó qué crudo

Strict types for style values (#269) 0d8c198a9 · Nico Burns ·

1pub fn compute() {
2    #[allow(unused_imports)]
3    use taffy::prelude::*;
4    let mut taffy = taffy::Taffy::new();
5    let node0 = taffy
6        .new_with_children(
7            taffy::style::Style {
8                size: taffy::geometry::Size {
9                    width: taffy::style::Dimension::Points(30f32),
10                    height: taffy::style::Dimension::Points(10f32),
11                    ..Size::auto()
12                },
13                ..Default::default()
14            },
15            &[],
16        )
17        .unwrap();
18    let node1 = taffy
19        .new_with_children(
20            taffy::style::Style {
21                size: taffy::geometry::Size {
22                    width: taffy::style::Dimension::Points(30f32),
23                    height: taffy::style::Dimension::Points(20f32),
24                    ..Size::auto()
25                },
26                ..Default::default()
27            },
28            &[],
29        )
30        .unwrap();
31    let node2 = taffy
32        .new_with_children(
33            taffy::style::Style {
34                size: taffy::geometry::Size {
35                    width: taffy::style::Dimension::Points(30f32),
36                    height: taffy::style::Dimension::Points(30f32),
37                    ..Size::auto()
38                },
39                ..Default::default()
40            },
41            &[],
42        )
43        .unwrap();
44    let node3 = taffy
45        .new_with_children(
46            taffy::style::Style {
47                size: taffy::geometry::Size {
48                    width: taffy::style::Dimension::Points(30f32),
49                    height: taffy::style::Dimension::Points(30f32),
50                    ..Size::auto()
51                },
52                ..Default::default()
53            },
54            &[],
55        )
56        .unwrap();
57    let node = taffy
58        .new_with_children(
59            taffy::style::Style {
60                flex_wrap: taffy::style::FlexWrap::Wrap,
61                align_items: taffy::style::AlignItems::FlexEnd,
62                size: taffy::geometry::Size { width: taffy::style::Dimension::Points(100f32), ..Size::auto() },
63                ..Default::default()
64            },
65            &[node0, node1, node2, node3],
66        )
67        .unwrap();
68    taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
69}