gioser

tawasuyu/taffy

A high performance rust-powered UI layout library

HTML 227Rust 7TOML 3CSS 1307 Definiciones

⎇ 0.2.x benches/generated/wrap_row.rs Rust · 66 líneas · 2.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 {
7                    width: taffy::style::Dimension::Points(31f32),
8                    height: taffy::style::Dimension::Points(30f32),
9                    ..Default::default()
10                },
11                ..Default::default()
12            },
13            &[],
14        )
15        .unwrap();
16    let node1 = taffy
17        .new_with_children(
18            taffy::style::Style {
19                size: taffy::geometry::Size {
20                    width: taffy::style::Dimension::Points(32f32),
21                    height: taffy::style::Dimension::Points(30f32),
22                    ..Default::default()
23                },
24                ..Default::default()
25            },
26            &[],
27        )
28        .unwrap();
29    let node2 = taffy
30        .new_with_children(
31            taffy::style::Style {
32                size: taffy::geometry::Size {
33                    width: taffy::style::Dimension::Points(33f32),
34                    height: taffy::style::Dimension::Points(30f32),
35                    ..Default::default()
36                },
37                ..Default::default()
38            },
39            &[],
40        )
41        .unwrap();
42    let node3 = taffy
43        .new_with_children(
44            taffy::style::Style {
45                size: taffy::geometry::Size {
46                    width: taffy::style::Dimension::Points(34f32),
47                    height: taffy::style::Dimension::Points(30f32),
48                    ..Default::default()
49                },
50                ..Default::default()
51            },
52            &[],
53        )
54        .unwrap();
55    let node = taffy
56        .new_with_children(
57            taffy::style::Style {
58                flex_wrap: taffy::style::FlexWrap::Wrap,
59                size: taffy::geometry::Size { width: taffy::style::Dimension::Points(100f32), ..Default::default() },
60                ..Default::default()
61            },
62            &[node0, node1, node2, node3],
63        )
64        .unwrap();
65    taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
66}