gioser

tawasuyu/taffy

A high performance rust-powered UI layout library

HTML 227Rust 7TOML 3CSS 1307 Definiciones

⎇ 0.2.x benches/generated/align_self_baseline.rs Rust · 58 líneas · 1.9 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                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_with_children(
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_with_children(
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_with_children(
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::MAX_CONTENT).unwrap();
58}