gioser

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 1061HTML 997Markdown 12TOML 83120 Definitions

⎇ 0.1.x benches/generated/align_self_baseline.rs Rust · 58 lines · 1.9 KB History Who touched what raw

Rename sprawl to taffy (#134) 8936790d6 · Alice Cecile ·

1pub fn compute() {
2    let mut taffy = taffy::Taffy::new();
3    let node0 = taffy
4        .new_node(
5            taffy::style::Style {
6                align_self: taffy::style::AlignSelf::Baseline,
7                size: taffy::geometry::Size {
8                    width: taffy::style::Dimension::Points(50f32),
9                    height: taffy::style::Dimension::Points(50f32),
10                    ..Default::default()
11                },
12                ..Default::default()
13            },
14            &[],
15        )
16        .unwrap();
17    let node10 = taffy
18        .new_node(
19            taffy::style::Style {
20                size: taffy::geometry::Size {
21                    width: taffy::style::Dimension::Points(50f32),
22                    height: taffy::style::Dimension::Points(10f32),
23                    ..Default::default()
24                },
25                ..Default::default()
26            },
27            &[],
28        )
29        .unwrap();
30    let node1 = taffy
31        .new_node(
32            taffy::style::Style {
33                align_self: taffy::style::AlignSelf::Baseline,
34                size: taffy::geometry::Size {
35                    width: taffy::style::Dimension::Points(50f32),
36                    height: taffy::style::Dimension::Points(20f32),
37                    ..Default::default()
38                },
39                ..Default::default()
40            },
41            &[node10],
42        )
43        .unwrap();
44    let node = taffy
45        .new_node(
46            taffy::style::Style {
47                size: taffy::geometry::Size {
48                    width: taffy::style::Dimension::Points(100f32),
49                    height: taffy::style::Dimension::Points(100f32),
50                    ..Default::default()
51                },
52                ..Default::default()
53            },
54            &[node0, node1],
55        )
56        .unwrap();
57    taffy.compute_layout(node, taffy::geometry::Size::undefined()).unwrap();
58}